Whats in your validateNif method - are you adding a error to ActionErrors if
its invalid?

 errors.add(field.getKey(), Resources.getActionError(request, va, field));


----- Original Message ----- 
From: "Diego" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 11, 2004 12:56 PM
Subject: Problems with custom validation


>
>
> Hi! I've created my own pluggable validator but it's not working. These
are the
> steps I've followed:
>
> First: I added this to validator-rules.xml
>
>         <validator name="nif"
>             classname="com.pruebas.MTValidations"
>                method="validateNif"
>          methodParams="java.lang.Object,
>                        org.apache.commons.validator.ValidatorAction,
>                        org.apache.commons.validator.Field,
>                        org.apache.struts.action.ActionErrors,
>                        javax.servlet.http.HttpServletRequest"
>               depends=""
>                   msg="errors.nif">
>         </validator>
>
> Second: I created the class com.pruebas.MTValidations with a "public
static
> boolean" validateNif method.
>
> Third: I added a errors.nif to my application resources file:
>
>         errors.nif='{0}' is not a valid NIF.
>
> When I test it, the method validateNif is called, and returns true or
false
> correctly, but the validator seems to omit the result and always thinks
the
> value is OK. By the way, I also have a <javascript> tag which I've omitted
here
> and the client validation works OK, but the server validation refuses to
work,
> despite of the result returned by validateNif (it never calls the "input"
> method). The standard validations (email, required, etc.) are working
properly,
> both client and server, in the same test and in the same conditions.
>
> Have I missed anything?
>
> thanks in advance
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to