TOPIC:

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

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

I see now that you have errors in your code, you haven't copied it properly.

Please try to use the following code and let me know whether it works:
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[i] != "") {
            jQuery("[name=\"ff_nm_JoinPlayerSelect[]\"]").append("<option value=" + lines[i] + " >"+ lines[i] +"</option>");
        }
    }
} // ff_textareaname_action

The main error is that you have been using
lines
instead of
lines[i]

Let me know whether this worked.

Regards,

Mihaela

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

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

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
No, sorry this doesnt work

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

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

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

Just to check, have you defined at least ONE option in the select list from the start.

This can, for example, be:
0;Choose option;

It is important that you have at least one option defined in the list otherwise the select list element won't be shown at all.

Regards,

Mihaela

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

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

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
seems to work fine now on creating a record, doesnt like it in edit

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

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

  • Topic Author
  • mrperfectpz
  • Away
  • Expert Breezer
  • Expert Breezer
  • Posts: 254
  • Thanks: 0
Ok, I put the code in the form Initialization Script and it all works great, thankyou !!!!
Going back to my other question.....

Select list will allow users to select more than one option and the number of selected options has to be 6?

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

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

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

I am glad that this solution is working as you wanted when you put it in the Initialization script.

Regarding selecting 6 options, would it be ok for you for this to be implemented as a validation script?

That way, if the number of selected options exceeds 6, they will get an error message saying to select fewer options and they won't be able to submit the form unless they do so.

Go to Properties of the select list element and in Validation section set Type to Custom.
In the code area that appears put the following code:
function ff_selectlistname_validation(element, message)
{
    var num = jQuery('[name="ff_nm_selectlistname[]"] option:selected').length;
   
    if (num > 6) {
        if (message=='') message = element.name+" faild in my test.\n"
        ff_validationFocus(element.name);
        return message;
    } // if
    return '';
} // ff_selectlistname_validation
NOTE: In the code above replace "selectlistname" with the actual name of the select list element.

Let me know whether this is working as you wanted.

Regards,

Mihaela

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

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