TOPIC:

Textarea values to select list 6 months 3 weeks ago #239263

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
How do I populate a select list dropdown values from values in textarea.
Also 6 must be selected and only allow max 6 ?

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

Last edit: Post by mrperfectpz.

Textarea values to select list 6 months 3 weeks ago #239294

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

Here is how to fill a select list with lines from textarea element as options.

Go to the Advanced properties of the textarea element. In the Actionscript section set Type to "Custom" and Actions to "Change".

In the code area that appears below put the following code:
function ff_textareaname_action(element, action)
{
    jQuery("[name=\"ff_nm_selectlistName[]\"] > option").remove(); 
    jQuery("[name=\"ff_nm_selectlistName[]\"]").append("<option value=>Choose option</option>");

    var lines = jQuery("[name=\"ff_nm_textareaname[]\"]").val().split("\n"); 
    for(var i = 0;i < lines.length;i++){
        if(lines[i] != "") {
            jQuery("[name=\"ff_nm_selectlistName[]\"]").append("<option value=" + lines[i] + " >"+ lines[i] +"</option>");
        }
    }
} // ff_textareaname_action
NOTE: In the code above you have to replace every instance of "textareaname" with the actual name of the textarea element in your form.

Furthermore, replace each instance of "selectlistName" with the name of the select list in your form which you wish to fill with options.

Let me know whether you have managed to apply this to your form and whether this is working as you wanted.

As for allowing users to select max and only 6, do you mean that this select list will have the "Multiple" checkbox checked so that users can select more than one option and the number of selected options has to be 6?

Regards,

Mihaela

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

Textarea values to select list 6 months 3 weeks ago #239305

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
I did as you mentioned but is not working :(

Also, yes I need "Multiple" so can select more than one and has to be 6

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

Textarea values to select list 6 months 3 weeks ago #239310

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

Can you please send me the code you are using so I can try to find a reason why it is not working for you?

I have tested this code on an example form and for me, it is working properly.

Regards,

Mihaela

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

Textarea values to select list 6 months 3 weeks ago #239317

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
Hi Again Michaela

Here is the code

function ff_PlayerNames_action(element, action)
{
jQuery("[name=\"ff_nm_JoinPlayerSelect[]\"] > option").remove();
jQuery("[name=\"ff_nm_JoinPlayerSelect[]\"]").append("<option value=>Choose option</option>");

var lines = jQuery("[name=\"ff_nm_PlayerNames[]\"]").val().split("\n");
for(var i = 0;i < lines.length;i++){
if(lines != "") {
jQuery("[name=\"ff_nm_JoinPlayerSelect[]\"]").append("<option value=" + lines + " >"+ lines +"</option>");
}
}
} // ff_PlayerNames_action

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

Textarea values to select list 6 months 2 weeks ago #239383

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
I have set up a test form with textarea and select list and called them the same as your code and copied your code, placed it in action for textarea and it still doesnt work. I thought it may have been a problem with my form but this proves not. I hope you can work it out.

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

Moderators: ForumSupport
Time to create page: 0.052 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!