Select multiple submit issue - POST is empty if not selected

Posted by Dasun on Stack Overflow See other posts from Stack Overflow or by Dasun
Published on 2012-10-30T10:41:52Z Indexed on 2012/10/30 11:01 UTC
Read the original article Hit count: 135

Filed under:
|
|
|

I have a multiple select as below.

enter image description here

It allows me to select options as below. Assume that 3 sports are selected.

enter image description here

When the items are select as shown above form submit is successful.

But unfortunately if the sports are not selected like below when the form is submitted post is empty.

enter image description here

Select box

<select style="width: 100px; height: 80px;" class="input" id="selected_sport_list" name="selected_sport_list[]" multiple="">
<option value="2">sport 2</option>
<option value="3">sport 3</option>
<option value="5">sport test x</option></select>

How can I make sure that when the form is submitted particular items are selected? Is it possible to use jquery to fix this ? or how?

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html