Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding validation_rules.xml file

 
Johnson David
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

We all know that validation_rules.xml file contains all the validation functions like date,credit card,email etc.

My question is , Can we add our own functions to that file ?

If so, what is the procedure ?

thanks in advance,

Johnson
 
Paras Jain
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can very well do that.
Just define your own validating class and declare it in validator-rules.xml

you have to mention in the validator tag like this


<validator name="myvalidationrule"
classname="org.test.example.MyValidatorRule"
method="validateSomeRule"
methodParams="list of parameters"
depends=""
msg="errors.myvalidationrule"/>

in validation.xml say
<field property="blahblahblah" depends="myvalidationrule"></field>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic