var $validate = array(
        'name' => array(
                'rule' => array('custom', VALID_NOT_EMPTY),
                'message' => 'Can\'t be empty'
        )
);

This is how i deal with not empty values. VALID_NOT_EMPTY may be
deprecated, but still it's just a constat so i can replace it with
whatever regexp i want. AFAIK 'allowEmpty' is false by default and
it's checked before rule description, and if u dont specify rule key
in field validation array it will default to 'blank'. In your example
Zoe field name will always invalidate because it can't be empty,
thanks to 'allowEmpty', but rule defaulted to 'blank' expecting it to
be empty.

On 9. Feb, 09:36 h., MonkeyGirl <[EMAIL PROTECTED]> wrote:
> > The 'allowEmpty' key should be assigned a boolean value.
>
> Ah, thank you. That makes sense. So I've replaced this:
>
>   var $validate = array(
>     'name' => array(
>       'required' => VALID_NOT_EMPTY
>     )
>   );
>
> With this now:
>
>   var $validate = array(
>     'name' => array(
>       array(
>         'message' => 'required',
>         'allowEmpty' => FALSE
>       )
>     )
>   );
>
> Is that right? (I know it technically works, I just want to make sure
> I'm doing it the "proper" way).
>
> Thank you,
> Zoe.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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