Andy, Its possible but you have to extend the commons validator, override the validate method and add the form fields (validation resources not action form) as a resource under <formFieldsKey>.
Extend the ValidatorActionForm and use your version of the validator. Default method parameters are defined in the ValidatorAction (class corresponding to the validator specified in the resource files). You can override this when you define your validator in the xml file by specifying methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest,<formFieldsKey> I am trying to do something similar to pass the validation results for some of my validators like daterange so I can compare the parsed value saved of in the result map by the date validator using parsed values associated to other form fields as min/max values. -Padma -----Original Message----- From: Andy Kriger [mailto:akriger@;greaterthanone.com] Sent: Tuesday, October 22, 2002 2:45 PM To: Struts Users Mailing List Subject: RE: how do i get a Field object in Validator? That much I understand - but is it possible to get a reference to the Field objec that represents that 2nd property? For example, if you wanted to get message arguments from the other field. -----Original Message----- From: Jerry Jalenak [mailto:Jerry.Jalenak@;LABONE.com] Sent: Tuesday, October 22, 2002 14:19 To: 'Struts Users Mailing List' Subject: RE: how do i get a Field object in Validator? In your validator-rules.xml file, add the following for each form field you need access to: <form name="yourForm"> <field property="firstProperty" depends="yourCustomRoutine"> <var> <var-name>secondProperty-Label</var-name> <var-value>secondProperty-Value</var-name> </var> </field> </form> secondProperty-Label would be what you want to call the variable in your custom routine; secondProperty-Value would be the actual form field name that contains the entered value. Then in your custom routine you can access these values by public static boolean yourCustomRoutine(Object object, ValidatorAction va, Field field, ActionErrors errors, HttpServletRequest request) { String fp = ValidatorUtil.getValueAsString(object, field.getProperty()); String sp = ValidatorUtil.getValueAsString(object, field.getVarValue("secondProperty-Label")); ... do something ... return true; // or false if the validation fails } HTH, Jerry > -----Original Message----- > From: Andy Kriger [mailto:akriger@;greaterthanone.com] > Sent: Tuesday, October 22, 2002 11:33 AM > To: Struts Users Mailing List > Subject: how do i get a Field object in Validator? > > > I am writing a custom rule and I need to know how I can get a > handle to a > different Field object? (not the one passed into the method > in the first > place) > > thx > a > > > > -- > To unsubscribe, e-mail: > <mailto:struts-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: > <mailto:struts-user-help@;jakarta.apache.org> > > This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at (800)388-4675. -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

