TOPIC:

Numbered list 7 months 3 days ago #239130

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
I have 2 textareas, I would like to be able to type names manually or paste a list of names into textarea2 and it will give a number for each line in textarea1. Also is it possible to not allow a blank line.

Please Log in or Create an account to join the conversation.

Numbered list 7 months 5 hours ago #239179

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

To copy values from textarea1 to textarea2 and add an order number before, do as follows.
Go to the Advanced properties of the "textarea1" and in the "Actionscript" section set Type to Custom and Action to Change.
In the code area that appears below put the following code:
function ff_textarea1_action(element, action)
{
    ff_getElementByName('textarea2').value = "";
    var count = 0;
    var lines = jQuery('#ff_elem14281').val().split("\n"); 
    for(var i = 0;i < lines.length;i++){
        if(lines[i] != "") {
            count = count + 1;
             ff_getElementByName('textarea2').value = ff_getElementByName('textarea2').value + count + ". " + lines[i] + "\n";
        }
    }

} // ff_textarea1_action
That should also check for the empty lines and skip them.

Let me know whether this is working as you wanted.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Numbered list 6 months 4 weeks ago #239203

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
Works perfect !!!

Is there a way to remove the blank line if they leave it in ?

Please Log in or Create an account to join the conversation.

Numbered list 6 months 4 weeks ago #239210

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

Great! I'm glad that it working as you wanted.

The code that I have provided will remove the blank lines, in sense, it will not copy empty lines to the second textarea.

Is that what you wanted?

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

Numbered list 6 months 4 weeks ago #239231

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
Yes kind of, I have changed the coding so that it only gives the number and not add the text.

function ff_playernames_action(element, action)
{
ff_getElementByName('position').value = "";
var count = 0;
var lines = jQuery('#ff_elem3768').val().split("\n");
for(var i = 0;i < lines.length;i++){
if(lines != "") {
count = count + 1;
ff_getElementByName('position').value = ff_getElementByName('position').value + count + "\n";


}

{ff_getElementByName('playernames').value = ff_getElementByName('playernames').value.toUpperCase(); }


}

} // ff_playernames_action


The coding doesnt allow blank lines, which works perfect, but Is there a way to not allow blank lines in 'playernames' ?

Please Log in or Create an account to join the conversation.

Numbered list 6 months 4 weeks ago #239240

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello again,

Great then.

I am glad that this is now working as you wanted.

Regards,

Mihaela

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!