I am working in cakephp1.3. i have to validate my form using cakephp validation in model.i added a regular expression to restrict special characters entry.
My code is written below:
var $validate = array(
'name' => array(
'unique'=>array(
'rule' => 'isUnique',
'message' => 'Already taken',
),
'pattern'=>array(
'rule' => '/^[a-z]$/i',
'message' => 'Only letters allowed',
),
'empty'=>array(
'rule' => 'notEmpty',
'message' => 'This field cannot be left blank',
))
);
rule 'unique' is not working. it was working fine before i added the 'pattern' rule in script.what is the issue? i try to place the order of rules i mentioned above, i thought there is may be some positioning issue but nothing happened.
plz help me..
Best Answer
Replace $ with +: