Numbered list

  • mrperfectpz
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 101
  • Thank you received: 0

mrperfectpz created the topic: Numbered list

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.
#239130
  • Posts: 3128
  • Karma: 105
  • Thank you received: 411

mihaela replied the topic: Numbered list

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
#239179
  • mrperfectpz
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 101
  • Thank you received: 0

mrperfectpz replied the topic: Numbered list

Works perfect !!!

Is there a way to remove the blank line if they leave it in ?
#239203
  • Posts: 3128
  • Karma: 105
  • Thank you received: 411

mihaela replied the topic: Numbered list

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
#239210
  • mrperfectpz
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 101
  • Thank you received: 0

mrperfectpz replied the topic: Numbered list

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' ?
#239231
  • Posts: 3128
  • Karma: 105
  • Thank you received: 411

mihaela replied the topic: Numbered list

Hello again,

Great then.

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

Regards,

Mihaela
#239240
Moderators: ForumSupporttomeperica
Time to create page: 0.068 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