Re: retaining multi select options with hidden fields

2005-09-23 Thread Laurie Harper

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


...


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


  

  

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


  

  

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]



RE: retaining multi select options with hidden fields

2005-09-23 Thread Vijaya S
If you use the same form bean for the second page and if you do not
initialize the String[] property in your form bean reset method, the form
bean values are available to the second page also.

Vijaya

-Original Message-
From: Tim Dudgeon [mailto:[EMAIL PROTECTED]
Sent: Friday, September 23, 2005 12:59 PM
To: user@struts.apache.org
Subject: retaining multi select options with hidden fields


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


...


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?

Tim



-
http://Struts_User_List.roomity.com";>roomity.com
roomity.com is broadband internet. ~~1127460559626~~
-



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]