Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
66
rated 0 times [  69] [ 3]  / answers: 1 / hits: 33143  / 11 Years ago, fri, october 18, 2013, 12:00:00

Here is a snippet of my code:
http://jsfiddle.net/natatkinson/xbWEb/



Javascript:



$(document).ready(function () {
$(#tags).select2({
maximumSelectionSize: 3
});

});


HTML:



<form name=form1 id=form1 action= method=GET>
<fieldset>
<legend>Shoe Info</legend>
<dl> <dt>Name:</dt>

<dd>
<input type=text name=name id=name size=40 placeholder=Shoe name required autofocus>
</dd>
</dl> <dt>Tags:</dt>

<dd>
<select multiple= name=tags id=tags style=width:100%;>
<option value=0>Select Tags</option>
<option value=2>racing flat</option>
<option value=3>track spikes</option>
<option value=1>trainer</option>
</select>
</dd>
</dl>
</fieldset>
<p class=submit-buttons>
<input type=submit class=button1 name=submit id=submit value=Add Shoes />
</p>




All that submits is 1 value, not a comma separated list like the documentation says.


More From » jquery

 Answers
323

You must use [] for multiple value contained form control's name.
Correct using at bottom:



<select multiple= name=tags[] id=tags style=width:100%;>

[#74885] Thursday, October 17, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaceyr

Total Points: 510
Total Questions: 97
Total Answers: 116

Location: Solomon Islands
Member since Fri, Oct 8, 2021
3 Years ago
;