Thanks cricket & AD7six.
I have used the following code to validate variable if it url or email.


    public $validate = array(
        'variable' => array(
              'url' => array(
                'rule' => array('urlOrEmail'),
                'message' => 'Please supply a valid URL/email address.'
            )
        )
    );

    public function urlOrEmail($field = array()) {
        $key = key($field);
        if(Validation::url($field[$key], true)) {
            return TRUE;
        } elseif (Validation::email($field[$key] ,true)) {
            return TRUE;
        } else {
            return FALSE;
        }
    }

Thanks

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to