How to use only certain validation set for validating data in Cake PHP?

Pichi

New Member
I was trying to validate my User model data and I came upon this problem.Say i have the following validation rules, stored in $validate variable:\[code\]var $validate=array( "username" => array( "usernameCheckForRegister" => array( "rule" => ..., "message" => ... ), "usernameCheckForLogin" => array( "rule" => ..., "message" => ... ) ), //rules for other fields );\[/code\]In the UsersController controller, I have two actions: register() and login().The problem is, how do I validate the username field in the register() action using ONLY the usernameCheckForRegister rule, and how do I validate the username field in the login() action, using the other rule, usernameCheckForLogin?Is there any behaviour or method in CakePHP which allows me to choose which set of rules to apply to a form field when validating?Thank you in advance for your help!
 
Back
Top