Friday, January 11, 2013

Conditional validation rule1 OR rule2

Hello,

I want to perform conditional validation between two rules

    public $validate = array(
        'variable' => array(
            'notEmpty' => array(
                'rule' => 'notEmpty'
            ),
         
             'url' => array(
'rule' => array('url', true),
'message' => 'Please supply a valid URL address.'
)

     'email' => array(
       'rule'    => array('email', true),
       'message' => 'Please supply a valid email address.'
   )

        )
    );

I want to check if the "variable" is url or email

Thanks,
gonzela2006

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: