On Fri, 1 Feb 2002, Andre Beskrowni wrote:
> Date: Fri, 1 Feb 2002 17:23:35 -0500
> From: Andre Beskrowni <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: 'Struts Developers List' <[EMAIL PROTECTED]>
> Subject: dynaforms & checkboxes
>
> i've been testing the dynaform stuff and i'm trying to use a checkbox
> element in my form with a default value of "true". (just for the sake of
> reference, the form property is called "booleanValue".) however, if i
> uncheck the checkbox and submit, the dynaform is always set to "true". i'm
> not sure if there's a workaround for this or not. i think the issue is that
> when you submit an unchecked checkbox, no request parameter is sent for it.
> so rather than sending booleanValue="false",
> request.getParameter("booleanValue")=null. as a result, when
> processPopulate() in RequestProcessor calls RequestUtils.populate(), the
> HttpRequest has no value for booleanValue and (i guess) just leaves it with
> its initialized value of "true".
>
> is this a case where RequestUtils.populate() needs a special case for
> setting null Boolean values to "false",
This is what the ActionForm.reset() method is for.
You cannot really do it in the populate() method -- how do you decide that
*every* boolean property in the underlying bean should be reset? It would
also be a horrendous breach of backwards compatibility to change something
like this now.
> or should the DynaActionForm logic
> somehow take care of this?
>
The default implementation of DynaActionForm.reset() does, in fact, reset
all booleans to false. But this assumption is one of the reasons I made
it possible for you to subclass DynaActionForm and override this decision.
> finally, let me know if this is something i should submit to bugzilla. i
> wasn't sure of the policy for nightly build stuff.
>
Bugzilla is still the right place, even on nightly builds -- there's an
option "Nightly" in the version number field for this purpose.
> ab
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>