Just add a dummy rule; if the 'allowEmpty' fails then the rule won't
be checked anyway:

array(
  'empty' => array('allowEmpty' => false, 'rule' => '/.*/', ...),
  'format' => ...
),

On Jun 30, 10:27 am, marikka <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I want to be able to validate my model so that first I get an error if
> a field is empty, and only then, if the field is invalid in another
> way.
>
> For example,this doesn't work, because my 'rule' for 'empty' is not
> set.
>
> var $validate = array(
>                 'myField' => array(
>                         'empty' => array('allowEmpty' => false, 'message' => 
> 'field_empty',
> 'last' => true),
>                         'format' => array('rule' => VALID_FORMAT, 'message' =>
> 'invalid_format')
>                 )
> );
>
> I could use the allowEmpty property with the latter format rule, but
> then I would only get one error message. The validator has the rule
> 'blank', but I really want the inverse: notBlank. Should I write my
> own validator function for something this trivial or is there a better
> way?
>
> Thanks in advance!
>
> -M
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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