Hello,

I am working on validation in 1.2 and I discovered some "strange"
behaviors. It could be my fault not using it the correct way. This is
mainly when using "required" and "allowEmpty" key words, this is some
cases I have noticed :

$validate = array('name' => array('required' => true));

Will produce a warning about a preg match (because the required
actually disppeared and the merging to $validator generated a rule
'blank')

$validate = array('name' => array(array('required' => true)));    //
why twice the array -> to eliminate the warning (preg_match) ?

Will eliminate the above warning, but since the check is done with
'blank', you always get 'This field can't be left blank' as error.

Actually the same using the keyword 'allowEmpty' when used alone.

Now such a rule also fails (removing required is ok):

$validate => array('name' => array('required' => true, 'rule' =>
'alphaNumeric'));

Well I can find workaround, but I wanted to replace the
VALID_NOT_EMPTY by the cake12 features etc ..

I also noticed the keyword 'last' and 'on', For 'on' actually quite
good because it can be chekd against 'create' and 'update' . Would be
perfect to have another keyword to check on the current action, ie :
'oncurrent' and we could set such rule  'oncurrent' => 'admin_edit'
etc ..
The 'last' is not implemented yet I think.

Though might be useful for others.

Franck


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to