You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gregory F. March" <ma...@gfm.net> on 2003/07/21 16:49:06 UTC

Using the validator for client side field modifications

Hi.  I've been reading through some of the documentation and I haven't
found exactly what I'm looking for.  I'm sure (famous last words) that
this is possible, but I need confirmation for a presentation I'm
making.

I have a form with text fields that I need to convert to upper case,
verify they contain only numbers, etc., but I need to do it "real time",
i.e. using onBlur (this is due to the fact that I am converting an
existing application and need similar functionality).  The users want to
see the fields converted and checked when they tab/click out of the
fields.

I have been reading about the validator and the "validator:javascript
formname=myForm" / "onSubmit=validateMyForm" tag combo, but I'm not sure
it does what I want as it seems to be doing a *form* validation.

Could someone point me in the correct direction?  My goal is to
consolidate all the javascript into the validator.xml file so I can
reference it by name.  Should I just be using a simple javascript
include instead?

Thanks,

/greg

--
Gregory F. March    -=-    http://www.gfm.net:81/~march    -=-    AIM:GfmNet

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


RE: Using the validator for client side field modifications

Posted by Yansheng Lin <ya...@isogis.com>.
You can call validateDate, etc anywhere in your form, provide that you loaded
then correctly.

Something like onblur="validateInteger()" will validate whether they are
integers: 

I don't think they implemented validateDecimals yet, so Hex and Oct would be
considered as valid as well.



-----Original Message-----
From: Gregory F. March [mailto:march@gfm.net] 
Sent: July 21, 2003 8:49 AM
To: Struts Users Mailing List
Subject: Using the validator for client side field modifications



Hi.  I've been reading through some of the documentation and I haven't
found exactly what I'm looking for.  I'm sure (famous last words) that
this is possible, but I need confirmation for a presentation I'm
making.

I have a form with text fields that I need to convert to upper case,
verify they contain only numbers, etc., but I need to do it "real time",
i.e. using onBlur (this is due to the fact that I am converting an
existing application and need similar functionality).  The users want to
see the fields converted and checked when they tab/click out of the
fields.

I have been reading about the validator and the "validator:javascript
formname=myForm" / "onSubmit=validateMyForm" tag combo, but I'm not sure
it does what I want as it seems to be doing a *form* validation.

Could someone point me in the correct direction?  My goal is to
consolidate all the javascript into the validator.xml file so I can
reference it by name.  Should I just be using a simple javascript
include instead?

Thanks,

/greg

--
Gregory F. March    -=-    http://www.gfm.net:81/~march    -=-    AIM:GfmNet

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


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