struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jouravlev <jmi...@gmail.com>
Subject Re: DynaActionForm, Boolean checkboxes, and Initial
Date Wed, 12 Oct 2005 17:40:37 GMT
On 10/12/05, katre <katre@henchmonkey.org> wrote:
> Michael Jouravlev wrote:
> > > 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).
> >
> > Um, right, you have to clear values associated with checkboxes in
> > reset method, right before the form fields are populated by Struts. I
> > guess, this means that you cannot use session-scoped dynaforms for
> > pages with checkboxes. I don't use dynaforms anyway but I see that
> > this is a shortcoming. You can still use request-scoped dynaforms.
>
> The problem is with both request and session-scoped dynaforms, when
> using the initial attribute if the form-property to pre-populate the
> form.  In this case, the form gets pre-populated with the "initial"
> value even when it is being populated from the request, which causes the
> problem.

Ah, I see, here is what seems to happen:

  * Dynaform is populated with "checked" value
  * JSP is displayed with checked checkbox
  * You uncheck the checkbox and submit form
  * When request comes:
    ** Struts creates dynaform with default "checked" value
    ** Struts populates form, unchecked value is not populated

Right, now there *is* a problem for request-scoped forms too. In my
forms I clear checkbox in reset() when POST comes. Dynaforms do not
allow that.

You can file a request in Bugzilla, or maybe even a patch ;-)

Michael.

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


Mime
View raw message