CakePHP seems to prefer form validation by class, not by method. I would like to validate the same fields for different methods, permitting different values for the field in each method. I have included class based validation for two of the methods. These two declaration would conflict if actually used. I would like to enable both, and associate validation with each respective method, not the class. How does Cake PHP effectuate this process, please?
for the function enabling an admin to add a user
public $validate = array(
'function' => array(
'int_role_id' => array(
'rule' => array('inList', array(1, 2)),
'message' => 'The role chosen must be an admin or an admin assistant.'
)
)
for the function enabling an admin assistant to add a user
public $validate = array(
'function' => array(
'int_role_id' => array(
'rule' => array('inList', array(3, 4, 5, 6)),
'message' => 'The role chosen must be something not an admin and not an admin assistant.'
)
)