Question

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    BB

The post sends the param twice. How can I do it to send something like.. projects: AA,BB ?

Thank you

Was it helpful?

Solution

This is the standard way to pass values as an array:

<select name="projects[]" ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top