I just wanted to ask a quick question about custom validators. At some point sooner or later the built in validators are not going to do the job. In the 1st iteration of this project I found myself needing to write custom constraints for unique values. I think we may have a way to solve that particular problem in the new version. Outside of unique I would like to get an idea
The idea going forward is you can pass a validator property which will basically be a method in the model like below but I haven't figured out if this always going to work yet or not. That is why I could really use some feedback on the things you are trying to validate that the built in rules can not accomplish.
// model constraints
this.constraints = [
{property="firstName",blank=false},
{property="lastName",blank=false},
{property="email",blank=false,email=true,unique=true,context="create,foo,bar"},
{property="age",blank=false,size="18..30"},
{property="passwordConfirm",blank=false,validator="passwordsMatch"},
{property="type",blank=false,inList="employee,manager"}
];
// custom validators
public boolean function passwordsMatch(){
if( getPassword() == getPasswordConfirm() ){
return true;
}
return false;
}