Hi,
Was able to fix the first problem by going into the js and checking for "select-one" and value=0. Regarding the 2nd issue, I have specified the class where I put the method in the valiation-xml e.g. my clasname="com.mypackagename.ui.RegistrationForm" and I have a method there called validateTwoFields(Object bean,ValidatorAction va,... just like yours. The only difference is that in errors.add() I have errors.add(field.getKey,StrutsValidatorUtil.getActionError(.....) and you have errors.add(field.getKey.ValidatorUtil.getActionError(..... I am compiling and running okay, but it never gets to this routine. (Thanks for your help by the way) Ben -----Original Message----- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: Friday, March 01, 2002 11:57 AM To: Struts Users Mailing List Subject: Re: Struts Validator Questions --- Ben Kafka <[EMAIL PROTECTED]> wrote: > Hi, > > I started using the struts validator package > about a week ago and have > the following questions: > > 1 - How do I get the validator to validate a > required field for a selection > box? > My selection is on an integer property. I noticed > in the > validator-rules.xml file it is checking for type > "select-one". What "type" > is a <html:select>? I tried replacing "select-one" > with "select" but it > still doesn't find it. The "select-one" is the correct type in Javascript for an html:select tag. I'm not sure what is in your select list, but if it is an integer how can you check that it is blank (zero length string) or null? You could use the range method to see if it falls in a range or write your own. > > 2 - Cannot get the two password comparison example > working. I put in the > code specified under ~dwinterfeldt. Was wondering if > anyone has gotten this > working. The only difference I can see in my code > and the example was that I > am using StrutsValidatorUtil.getActionError instead > of > ValidatorUtil.getActionError (the latter the > compiler complained about no > such method signature). Was wondering if there was a > javascript method also > that could be included. No error messages? Everything works on the same principle. Does the validator definition in the xml have the same method and class defined as where the validation method actually is (no types)? You can make a Javascript method to match if you want to. You can follow one of the examples to see how to make a generic Javascript method. You have access to the error message and the variables you've defined in the Javascript. David > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>