Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How to keep previous selected value in "Clay:select"
In Inquiry/Screach Screen, I would like to keep the value which is previousely selected value. My code is below :
<% List<SelectOption> statusOptions = new ArrayList<>();
statusOptions.add(new SelectOption("Pending Review", String.valueOf("1")));
statusOptions.add(new SelectOption("Rejected", String.valueOf("2")));
statusOptions.add(new SelectOption("Approved", String.valueOf("3")));
%>
<clay:select label="Status"
name="<%=curPortletNameSpace+"status" %>"
options="<%= statusOptions %>" />
Let's say I choose "Rejected" status and then find the result. In search screen, I want to keep and show "Rejected" value in Search form while showing the result data. But it always change to first value of drop down box and not able to keep last selected value when showing result. Could anyone help me to show the previous selected value in <clay:select > ?
Hi,
Try sending selected parameter as True ,while creating Select option
SelectOption sel = new SelectOption(label, value, selected)
It worked out now. Thank Mohammed Yasin . Your info helped alot.
Powered by Liferay™