Line Count

  • mrperfectpz
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 62
  • Thank you received: 0

mrperfectpz created the topic: Line Count

I would like to add a textarea next to a textarea that will give a number for entires into the textarea ie

1. Text
2. Text
3. Text
4. Text
5. Text

Etc, etc
#238527
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2823
  • Karma: 95
  • Thank you received: 379

mihaela replied the topic: Line Count

Hello,

Please explain a bit more what exactly do you want to achieve because I'm not sure.

If you wish to add numbers in front of each line, copying values from textfield to textarea as explained here crosstec.org/en/forums/1-forums/126875-t...e-solved.html#238483 , I can give you further instructions based on this example.

Regards,

Mihaela
#238540
  • mrperfectpz
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 62
  • Thank you received: 0

mrperfectpz replied the topic: Line Count

I have 2 textareas. I would like the first textarea to add a number for each entry into the other textarea. So it automatically adds a new number when new entry is added. ie.

textarea 1 Textarea 2

1 dfdsfdjfks
2 dsdfsdfsdf
3 sdfsdfsdfsd
4 dfsdfsdfsdf
5 fdsdfsdfsdf
etc

I hope this explains :)
#238549
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2823
  • Karma: 95
  • Thank you received: 379

mihaela replied the topic: Line Count

Hello,

I think that now I understand how you would like this to work.

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)
{  len = ff_getElementByName('textarea2').value.split(/\r\n|\r|\n/).length
    ff_getElementByName('textarea2').value = ff_getElementByName('textarea2').value + len + ". " + ff_getElementByName('textarea1').value + "\n" ; 
    ff_getElementByName('textarea1').value = "";
} // ff_textarea1_action
NOTE: In the code above replace "textarea1" withe the anme of first textarea and "textarea2" with the name of the second textarea.

Let me know whether this is working as you wanted.

Regards,

Mihaela
#238553
  • mrperfectpz
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 62
  • Thank you received: 0

mrperfectpz replied the topic: Line Count

Hi

Thankyou for your work, but is there a way to place the numbers in 1 textarea and the values in another
#238567
  • mihaela
  • Away
  • Administrator
  • Administrator
  • Posts: 2823
  • Karma: 95
  • Thank you received: 379

mihaela replied the topic: Line Count

Hello,

Oh, you would like that each line which is added from TEXTFIELD passes text to one textarea and order numbers are added to a second textarea.
function ff_textfieldname_action(element, action)
{  
    ff_getElementByName('textarea1').value = ff_getElementByName('textarea1').value + ff_getElementByName('textfieldname').value + "\n" ; 
    ff_getElementByName('textfieldname').value = "";

    len = ff_getElementByName('textarea2').value.split(/\r\n|\r|\n/).length
    ff_getElementByName('textarea2').value =  len + "." + "\n" ; 

} // ff_textfieldname_action
Adjust the names of the elements and let me know whether it works.

Regards,

Mihaela
#238569
Moderators: ForumSupporttomeperica
Time to create page: 0.065 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here