Okay. I was hoping that I didnt have to use a CustomValidator for it but oh well. Thanks for the great example! :) I'll make sure to look it over. Thanks, -Tim
-----Original Message----- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 3:53 PM To: 'Struts Users Mailing List' Subject: RE: date validation Tim wrote: > Is there a way to validate a date against today's date? > I can validate that a date is entered in a desired format but I'm not sure how to > validate that it is = to or > then today's date using just the validation.xml. > Do I have to use a custom validator? I think you would have to do a custom validator. I did, too, for a different issue, and it wasn't terribly hard. You need a class of your own (ValidationUtil?) with a method: public static boolean lenientDate( Object bean, ValidatorAction va, Field field, ActionErrors errors, Validator validator, HttpServletRequest request ) Then an addition to validation.xml: <form-validation> <global> <validator name="lenientDate" classname="edu.asu.vpia.struts.ValidationUtil" method="validateDate" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest" msg="errors.date"> </validator> </global> <formset> ... Then use it in the 'depends' attribute as usual! You might need some extra pieces in ApplicationResources.properties depending on what errors you want to show. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University PA Information Resources Management --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]