Catch all values from a select (weebspeed)

Posted by Pierre Blitzkow on 27-Aug-2018 15:19

Hello,

I need get value from input select but I can not:

My select is dynamically filled:

<select name ="selectDesc" id="selectDesc" style="width: 50px" size="4"></select>

In the weebspeed I try get value thus:

vc-desc = get-field("selectDesc") or vc-desc = get-value("selectDesc")

But the return value is the last value add in the select, but I need of all values in the select.

thanks in advance.

Posted by rayherring on 29-Aug-2018 16:36

Webspeed won't be able to get all the options from the select, when you submit an HTML form, only the selected option from the select dropdown is sent (or in the case of a select that is 'multiple', only the selected options).

All Replies

Posted by Marco Mendoza on 27-Aug-2018 15:52

Would be better if you show a greater block of code not just 1 line.

Anyway, I think your problem is you are closing the select before the <options>, and should be at the end:

<select  id="autoimp" name="autoimp" >

<option value="" `IF autoimp = "" THEN "selected" ELSE ""`>Both</option>

<option value="yes" `IF autoimp = "yes" THEN "selected" ELSE ""`>Yes</option>

<option value="no" `IF autoimp = "no" THEN "selected" ELSE ""`>No</option>

</select>

Note: Add "multiple" if you want multiple values selected: <select multiple id="autoimp" name="autoimp" >

Posted by Pierre Blitzkow on 28-Aug-2018 06:18

Hello Marco,

Like I said, the select is filled dynamically, with this code:

$("#btn_desc_adic").on("click", function() {

      $('#selectDesc').append('<option value="' + $("#desc_adic").val() + '" selected="selected"> +' + $("#desc_adic").val() + '</option>');

      $('[name="desc_adic"]').val('');

  });

So after submit I need catch all values inserted in the select.

Posted by Marco Mendoza on 29-Aug-2018 09:27

Do yo tried using "multiple"?  <select multiple id="autoimp" name="autoimp" >

Posted by Peter Judge on 29-Aug-2018 12:02

Is the complete set of items being sent back to the server? If I understand your setup, the WebSpeed doesn't know anything about the client-rendered HTML.

Posted by rayherring on 29-Aug-2018 16:36

Webspeed won't be able to get all the options from the select, when you submit an HTML form, only the selected option from the select dropdown is sent (or in the case of a select that is 'multiple', only the selected options).

Posted by Pierre Blitzkow on 30-Aug-2018 05:55

Thank you guys,

I solved my problem put value adding in the select to input hidden too, thus I get the values from this input in the submit.

This thread is closed