掲示板

Multiple dropdown option selection loosing data on submit

thumbnail
7年前 に Raju V によって更新されました。

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
7年前 に Jack Bakker によって更新されました。

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

Liferay Master 投稿: 978 参加年月日: 10/01/03 最新の投稿
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
7年前 に Raju V によって更新されました。

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.?