I just checked the Struts source code, and getMap() returns a reference to the internal hash map, so changes to items in the map will be reflected in the form bean.
-ed On 8/31/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: > That's correct Ed, but there is no way to set it back, unless I modify the > code, right? > > > >From: Ed Griebel <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <user@struts.apache.org> > >To: Struts Users Mailing List <user@struts.apache.org> > >Subject: Re: Trim all fields before validation > >Date: Wed, 31 Aug 2005 15:48:30 -0400 > > > >If you don't want to write javascript to do it, Frank's suggestion > >looks like your best bet, but I've only looked at the Javadoc not the > >code behind it. > > > >If you want to brute-force it, you can certainly get the map out of a > >DynaForm easily enough: > >Map values = (DynaValidatorActionForm form).getMap(); > > > >-ed > > > >On 8/31/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: > > > I still need to look at Frank's suggestion. Thanks for your suggestions > > > Frank and Joe. > > > > > > So Joe, you would trim all the fields using javascript right? I > >understand > > > your suggestion. I was hoping that just before I call validate in my > >action, > > > I could write a generic loop to loop around the keyset (I suppose this > >is > > > not exposed by DynaValidatorActionForm, like it would be for say a > >Hahmap) > > > and trim all the Strings on the form. But I am not sure how I can get > >the > > > keyset. > > > > > > Javascript can always work and I do use javascript, but always as a last > > > resort. > > > > > > All ideas are welcome. > > > > > > >From: Joe Germuska <[EMAIL PROTECTED]> > > > >To: "Dilip Ladhani" <[EMAIL PROTECTED]>, user@struts.apache.org > > > >Subject: Re: Trim all fields before validation > > > >Date: Wed, 31 Aug 2005 13:58:50 -0500 > > > > > > > >At 2:49 PM -0400 8/31/05, Dilip Ladhani wrote: > > > >>Hello all, > > > >> > > > >>I was searching for the best way to do this. > > > >> > > > >>I want all the fields on my form to be trimmed before they are sent > >for > > > >>validation (I call validate from my action class). What's the best way > >to > > > >>do this if I have DynaValidatorActionForm? > > > > > > > >Personally, I'd make this part of an onsubmit handler in the page. > > > > > > > >You can't really intervene in the form population process on the Struts > > > >side right now (although arguably that's something which should be > >exposed > > > >for user customization better). > > > > > > > >I suppose maybe you could extend DynaValidatorActionForm and try to > > > >intervene in how it handles property setting, but it's pretty abstract, > >so > > > >that may be a big challenge. > > > > > > > >And, of course, you could sacrifice your dynaforms and implement your > >own > > > >form bean classes which trim any non-null string value which is > >applied. > > > > > > > >Joe > > > > > > > >-- > > > >Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com > > > >"Narrow minds are weapons made for mass destruction" -The Ex > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]