In my custom validators, I have the methodParams looks like this:
methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest"
and then do this in the method right before returning false: errors.add(field.getKey(), Resources.getActionMessage(request, va, field));
The other thing may be to try taking the property attribute off of your html:errors tag.
Matt
Anna Kerekes wrote:
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]