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]