commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shah, Shrihas \(OFT\)" <>
Subject RE: Validation on An optional field that if supplied passes a validation
Date Wed, 26 May 2004 19:50:12 GMT
HI Mike:

One of the way is to check in your form's validation method. First you
call super.validate  and then call the method GenericValidator' isDate
method to validate the date. Take validation out of validation.xml

Here is the code snippet

	public ActionErrors validate(
		ActionMapping mapping,
		HttpServletRequest request) {

		ActionErrors errors = super.validate(mapping, request);
		GenericValidator gv = new GenericValidator();
		if(!Util.isNull(this.getDob()) &&
			errors.add("dob", new
		return errors;


I hope this helps.

Shrihas Shah
NYS Office for Technology
Phone (518) 473-5023
Fax (518) 473-3389
(US Postal Service Regular Mail Address)
State Capitol ESP, PO Box 2062
Albany, NY 12220-0062
(Parcel Post/Overnight and Interagency Mail Address)
Empire State Plaza
Swan St., Core 4, 1st Floor
Albany, NY 12223
-----Original Message-----
From: Mike Tedesco [] 
Sent: Wednesday, May 26, 2004 9:01 AM
To: Jakarta Commons Users List
Subject: Validation on An optional field that if supplied passes a

Can someone tell me how I set up a form validation in my xml that can be
optional (i.e. passed as null). But if it is supplied then I can perform
the validation



<arg0 key="ilt.Email2"/>



Like above I want only the email validation to be performed if the field
is not null.


-- Thanks

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message