You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jaye Bass <ja...@knology.net> on 2003/04/03 17:31:45 UTC
Multiboxes in Wizard Forms
I solved a problem that I'd been having with multiboxes and wanted to present
it to the list for a sanity check.
Specifically, I had a 3 page wizard that essentially edited an existing model
bean. I'm using a single form bean across the three pages. The third page of
the wizard had a multi-box that is prepopulated by model. The original
problem was a common one, namely when I deselected every box I was not
getting the behaviour that I was expecting. I read a bit and implemented
reset(). This introduced a new problem...my multi-box came up empty. Since
the multi-box is backed by a String array, I first tried to send a hidden
property through the pages until I needed it in the last page. That didn't
work. Finally I came up with a duplicate property let's call it:
form.get(set)HiddenMultiBoxProperty();
when the form was loaded with the data to be edited I loaded this "hidden"
property with the initial values for the multi-box (but the member field
backing this property was not included in the reset()). In the action that
eventually presented the multi-box, I loaded the "real" multi-box property
with the array stored in my "hidden" property. This strategy gave me the
behaviour I was looking for...namely, the multi-box was initialized with the
proper values AND I could detect that all the values were deselected when the
page containing the multi-box was submitted.
IMO, this seems to be a general solution to this type of problem.
Any comments, suggestions?
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org