Take a look in FieldChecks to see how other validators work:

http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/validator/


Having said that, returning "false" just stops the validation from
proceeding for that field, you need to add an error message - looks to me
like you need to add ActionMessages to your validateDate() method

Niall

----- Original Message ----- 
From: "Anna Kerekes" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, October 01, 2004 3:42 PM
Subject: validator-rules.xml behaviour


Hello,

I am trying to add my own custom validation method to my validator-rules.xml
file.
Here's the new snippet I am adding (Validator is a utility class I wrote to
perform extra validation):

<validator name="dateCheck"

classname="com.onx.usermanager.util.Validator"

method="validateDate"

methodParams="java.lang.Object"

msg="error.date.invalid" />

I have tried debugging my code, the validator does indeed go into my
validateDate method and returns a boolean=false.

However, contrary to what I believed was going to happen, it does not throw
the error.date.invalid ........is this not what is supposed to happen by
default if the validator returns a false boolean?

I think everything else is fine, in my jsp I have

<td><html:errors property="date"/></td>

and in my validation.xml:

<field property="date" depends="dateCheck">

</field>

and in my ApplicationResources.properties file I have:

error.date.invalid=<li><font color="red">End Date must be after Start
Date</font></li>

Please help me, any help is appreciated,

you can email me directly at [EMAIL PROTECTED],

thanks,

Anna

p.s. I can do other validations with my xml files fine, it is just this
custom one not working...


---------------------------------------------------------------------
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