in Cakephp we set all validation in model ! but many time we didn’t need some validation for particular field !
in that condition how to remove that validation ?
its very simple , you need to write some line in controller
- //Remove only Single Rule of a field
- $this->User->validator()->remove(‘phone’, ‘rule1′);
- //Completely remove all validation rules of a field
First Line of code will remove only the rule1 of phone field
Second line of code will remove all Validation of phone field .