留言板

Multiple dropdown option selection loosing data on submit

thumbnail
Raju V,修改在7 年前。

Multiple dropdown option selection loosing data on submit

New Member 帖子: 11 加入日期: 16-10-19 最近的帖子
Hi, I have a multiple drop-down in my portlet form. When I select some values and submit the form, drop-down is loosing the selected data and showing only one option which is first option in selected ones. How do I prevent this form happening.

<aui:select id="test" name="test" label="test" multiple="true" title="test">
<aui:option label="0" value="0"/>
<aui:option label="1" value="1"/>
<aui:option label="2" value="2"/>
<aui:option label="3" value="3"/>
</aui:select>
thumbnail
Jack Bakker,修改在7 年前。

RE: Multiple dropdown option selection loosing data on submit (答复)

Liferay Master 帖子: 978 加入日期: 10-1-3 最近的帖子
Raju V:
Hi, I have a multiple drop-down in my portlet form. When I select some values and submit the form, drop-down is loosing the selected data and showing only one option which is first option in selected ones. How do I prevent this form happening.

<aui:select id="test" name="test" label="test" multiple="true" title="test">
<aui:option label="0" value="0"/>
<aui:option label="1" value="1"/>
<aui:option label="2" value="2"/>
<aui:option label="3" value="3"/>
</aui:select>

You need to let it know which options are to be selected. Look at the 'selected' attribute of the aui:option.
<aui: option label="2" value="3" selected = "${*trueFalseConditionHere*}"/>
thumbnail
Raju V,修改在7 年前。

RE: Multiple dropdown option selection loosing data on submit

New Member 帖子: 11 加入日期: 16-10-19 最近的帖子
Actually, we dont need to set selected attribute for single select drop-downs( or text boxes ) as it keeps the selected option even after form is submitted. Don't we have something which saves the current state of multi select drop down selection instead of binding selected values again.?