Forums de discussion

Multiple dropdown option selection loosing data on submit

thumbnail
Raju V, modifié il y a 7 années.

Multiple dropdown option selection loosing data on submit

New Member Publications: 11 Date d'inscription: 19/10/16 Publications récentes
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, modifié il y a 7 années.

RE: Multiple dropdown option selection loosing data on submit (Réponse)

Liferay Master Publications: 978 Date d'inscription: 03/01/10 Publications récentes
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, modifié il y a 7 années.

RE: Multiple dropdown option selection loosing data on submit

New Member Publications: 11 Date d'inscription: 19/10/16 Publications récentes
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.?