0

I've build a JSP page that contains a form with two multiple select objects and several buttons to send the elements from one to other. When the user has finished choosing the elements, clicks on a button to submit the form. The form data is encapsulated through commandName="mainForm" in the JSP to a java POJO class MainForm that represents that form. The problem here is that the POSTed elements from the multiselect objects are only those who remain "selected" (in blue) when the user submits the form. Is there any clean way (without JQuery) to send all the options?

Thanks in advance!!

4

1 回答 1

0

您应该在表单的“onsubmit”事件上编写一个 JS 代码,以编程方式选择多选的所有选项。(因此,将所有选项设为蓝色)

就像在 jQuery 中一样,

$('#form #selectId option').attr('selected', 'selected');

我没有看到更好的方法。

于 2013-06-14T09:45:22.760 回答