I had a custom validator 'futureDate' for which I needed to pass in a date and time which were 2 different form fields, to check that the date was in the future.
I passed 2 different values into a custom parameter using two args and vars: <form name="form"> <field property="emailDate" depends="required, mask, futureDate"> <msg name="mask" key="errors.invalid"/> <arg0 key="form.emailDate"/> <arg1 key="form.emailTime"/> <var> <var-name>mask</var-name> <var-value>${dateMask}</var-value> </var> <var> <var-name>time</var-name> <var-value>emailTime</var-value> </var> </field> </form> In the custom validator I retrieved the two values using: public static boolean validateDate(Object bean, ValidatorAction va, Field field, ActionErrors errors, HttpServletRequest request) { String value; if (isString(bean)) { value = (String) bean; } else { value = ValidatorUtil.getValueAsString(bean, field.getProperty()); } String propertyTime = field.getVarValue("time"); String valueTime = ValidatorUtil.getValueAsString(bean, propertyTime); . . . . . Hope this helps Claire -----Original Message----- From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] Sent: 26 February 2004 14:54 To: [EMAIL PROTECTED] Subject: custom validator question I'm creating a custom validator to enforce a <= relationship between 2 date fields and am having a problem. A validator method gets a Field arg for the field with which it's associated in validation.xml, but I need to also get the Field object for the other date field. I need this so that I can get its property name for display in an error message. (I'd also like to be able to get the field's datePattern.) I can't figure out how to do this. Any help would be much appreciated! jim Here's the relevant part of my validation.xml file: <form name="ActivityViewForm"> <field property="starting" depends="date"> <arg0 key="ActivityViewForm.starting.displayname"/> <var> <var-name>datePatternStrict</var-name> <var-value>MM/dd/yyyy</var-value> </var> </field> <field property="ending" depends="date,date1LEdate2"> <arg0 key="ActivityViewForm.ending.displayname"/> <var> <var-name>datePatternStrict</var-name> <var-value>MM/dd/yyyy</var-value> </var> <var> <var-name>date1</var-name> <var-value>starting</var-value> </var> </field> </form> ________________________________________________________________________ E-mail is an informal method of communication and may be subject to data corruption, interception and unauthorised amendment for which Digital Bridges Ltd will accept no liability. Therefore, it will normally be inappropriate to rely on information contained on e-mail without obtaining written confirmation. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ________________________________________________________________________ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]