Skip to main content

Posts

Showing posts with the label Validationset

CakePHP-MultivalidatableBehavior: Using many validation rulesets per model.

If you are looking for action specific validation on a model then here it goes like that : Following code examples are based on the following scenario: 1) We have a model Member. 2) We wanna two type of validation sets on that.      a) First in case of Login (default)      b) Second in case editing Profile.  3) How to use these validation sets in action. Step 1 : <?php      class MultivalidatableBehavior extends ModelBehavior {     /**      * Stores previous validation ruleset      *      * @var Array      */     var $__oldRules = array();     /**      * Stores Model default validation ruleset      *      * @var unknown_type      */     var $__defaultRules = array();     funct...