Fetching List Box selected values

List Box in HTML form is nothing but the select tags which has got a attribute called multiple.

How to create List Box

<select name="mylist" multiple>
<option value="1">www.SpikeSource.com</option>
<option value="2">www.google.com</option>
<option value="3">www.foss.in</option>
</select>

The above html tags will transform to the below list box.

you cannot get the values of list box if more than one item is selected. In order to get that, you need to create a hidden text box and store the selected values using a separator using javascript

<input type="hidden" name="hiddenmylist" value="">

This hidden value can be caught through serialized posted values in the server side. Further processing of data could be done by unserializing it.

MediaWiki

This page has been accessed 6,100 times.

This page was last modified 19:38, 22 June 2006.