如何在jQuery Chosen Multiselect中张贴选定的元素(How to POST selected elements in the jQuery Chosen Multiselect)
我有一个基于spring的表单,以便发布我的用户注册。 最近,我不得不更新我的表单以允许用户选择项目。 这种选择需要多选,因为它可以有多个选项。
我选择的选择是这样的:
<select name="projects" data-placeholder="Click to choose your project(s)" multiple class="chosen-select" style="width:350px;" tabindex="2"> <option value=""></option> <option value="AA">AA</option> <option value="BB">BB</option> <option value="CC">CC</option> </select>我指定了name属性来发送参数,但行为不是预期的行为:
projects AA projects BB该帖子发送了两次参数。 我该怎么做才能发送像..项目:AA,BB?
谢谢
I have a spring based form in order to POST my user registration. Recently, I had to update my form to allow users a project selection. This selection needs a multiselect because it can be more than one option.
My chosen select is like this:
<select name="projects" data-placeholder="Click to choose your project(s)" multiple class="chosen-select" style="width:350px;" tabindex="2"> <option value=""></option> <option value="AA">AA</option> <option value="BB">BB</option> <option value="CC">CC</option> </select>I specified the name attribute to send the param but the behaviour is not the expected one:
projects AA projects BBThe post sends the param twice. How can I do it to send something like.. projects: AA,BB ?
Thank you
最满意答案
这是将值作为数组传递的标准方式:
<select name="projects[]" ...This is the standard way to pass values as an array:
<select name="projects[]" ...更多推荐
发布评论