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.
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).
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" >
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.
Do yo tried using "multiple"? <select multiple id="autoimp" name="autoimp" >
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.
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).
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.