Tim Dudgeon wrote:
I need to retain the selections a user has made using a multi-select on one
page by using hidden fields on the next page.
On the first page I have a
<html:select multiple="true" property="multiSelectProp" ...>
...
</html:select>
multi-select which is populating a String[] property of a form bean, and then
on the second page I need to retain those selections using hidden fields. What
is the syntax I need to use for the hidden fields to ensure that the String[]
property gets set correctly by the BeanUtils magic?
Do I need to iterate through the values of the String[] and write out an
indexed hidden field for each one?
Yep, except it needn't be written as an indexed field unless order is
important. So, something like
<logic:iterate name="MyForm" property="multiSelectProp" id="value">
<html:hidden property="multiSelectProp" value="${value}"/>
</logic:iterate>
will do it. If order *is* important, you'll need to include "[#]" on the
end of the property name, where # will be the iteration number.
Something like
<logic:iterate name="MyForm" property="multiSelectProp"
id="value" indexId="row">
<html:hidden property="multiSelectProp[${row}]" value="${value}"/>
</logic:iterate>
Note, I haven't tested either solution, but something along those lines
is what you need.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]