简体   繁体   English

如何在jQuery选择的Multiselect中发布所选元素

[英]How to POST selected elements in the jQuery Chosen Multiselect

I have a spring based form in order to POST my user registration. 我有一个基于Spring的表单,以便发布我的用户注册。 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: 我指定了name属性来发送参数,但是行为不是预期的:

projects    AA
projects    BB

The post sends the param twice. 该帖子两次发送参数。 How can I do it to send something like.. projects: AA,BB ? 我该如何发送类似项目:AA,BB?

Thank you 谢谢

这是将值作为数组传递的标准方法:

<select name="projects[]" ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 选择jQuery插件-在Multiselect中限制所选选项 - Chosen jQuery plugin - Limit Selected Options in Multiselect 如何使用jQuery以与多选框中相同的顺序检索多选的所有选定和非选定元素 - How to use jQuery to retrive all the selected and non selected elements of a multiselect in the same order as it is in multiselect box PHP Multiselect与选择的jQuery-返回所有值,不仅是选定的 - PHP Multiselect with Chosen jQuery - Returning all values not just selected jQuery选择Multiselect MVC 5未在“编辑”表单上填充所选值 - Jquery Chosen Multiselect MVC 5 is not populating selected values on Edit form 如何从选定的multiselect插件中获取上一个选定的项目 - How to get last selected item from chosen multiselect plugin 如何在For循环下获取选择的Multiselect选定值 - How to get Chosen Multiselect selected values under the For Loop 多选中的jQuery Chosen Higlight选项 - jquery Chosen Higlight option in Multiselect 如何将多选选定选项作为URL中的一个参数发布-Bootstrap Multiselect - How to post multiselect selected options as one param in url - Bootstrap Multiselect jQuery选择:带有远程数据的多选 - jQuery Chosen: Multiselect with remote data 如何在选定控件上使用Jquery Multiselect插件 - How to use Jquery Multiselect plugin on selected controls
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM