struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@henchmonkey.org (katre)
Subject Re: DynaActionForm, Boolean checkboxes, and Initial
Date Wed, 12 Oct 2005 16:33:16 GMT
Dave Newton wrote:
> katre wrote:
> 
> >The basic problem, as before, is that it is totally impossible in struts
> >to default a checkbox to true, and still be able to detect when it is
> >uncheked by a user.
> > 
> >
> Wow. All those apps of mine, ruined ;)

Well, I figured, since no one replied to my first email, why not get
dramatic and see what happens? :)

> Um, well, what _I've_ been doing is setting the appropriate ActionForm 
> value before I display the form, not in reset but in the Action's 
> execute method (reset works too, but because I've never used 
> validate="true" I'm doing setup stuff in the Action anyway). After form 
> submision I look at the form value of the checkbox (I usually use 
> Boolean, but I almost always use DynaValidatorActionForms, so YMMV on 
> that one).

Right, and this does work, but it requires having a separate action
leading to every form.  Which isn't such a huge inconvenience, really,
just more code.

More importantly (and getting back to my original question), it means
that when using a dyna form, you can't use the initial attribute for
properties.  You have to write code to set them to the default value in
that separate action (and thus separating the form from the logic).

Thanks very much for your help,
katre


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message