Chris,
Your issue is 'VALID_EMAIL' is not a valid regular expression.  Take a look
here for how to use regular expressions to validate the email address.

http://www.developphp.com/view_lesson.php?v=224

 - Jon


On Fri, Nov 2, 2012 at 9:35 AM, Chris <[email protected]> wrote:

> thank you for your reply chetan,...
> I'm steel getting an error:
> Warning (2): preg_match() [function.preg-match]: Delimiter must not be
> alphanumeric or backslash [APP/controllers/invitations_controller.php, line
> 83]
>
> this is my invitations model:
>
>     var $validate = array(
>      'user_id' => array(
>       'rule' => 'notEmpty',
>       'message' => 'user must be valid',
>      ),
> 'email'=> array(
>                     'mustNotEmpty'=>array(
>                         'rule' => 'notEmpty',
>                         'message'=> 'Please enter email',
>                         'last'=>true),
>                     'mustBeEmail'=> array(
>                         'rule' => array('email'),
>                         'message' => 'Please enter valid email',
>                         'last'=>true)
>                     ),
>
>  );
>
> and this is what I have in a invitations controller:
>         $emails = array();
>
>         if(!empty($this->data['Invitation']['emails']))
>         {
>           $raw_emails = explode(',', $this->data['Invitation']['emails']);
>           foreach($raw_emails as $email)
>           {
>             $email = trim($email);
>             if(preg_match('VALID_EMAIL', $email)) // This is where I'm
> getting an error...
>               $emails[] = $email;
>           }
>
>  debug($email);
>
> I placed the debug in,... and I'm reading test email in the view,... but
> steel getting an error
>
>
>
> On Friday, November 2, 2012 6:52:42 AM UTC-7, chetan varshney wrote:
>
>> For email validation you should use-
>>
>> 'email'=> array(
>>                     'mustNotEmpty'=>array(
>>                         'rule' => 'notEmpty',
>>                         'message'=> __('Please enter email'),
>>                         'last'=>true),
>>                     'mustBeEmail'=> array(
>>                         'rule' => array('email'),
>>                         'message' => __('Please enter valid email'),
>>                         'last'=>true)
>>                     ),
>>
>> and for deep checking
>>
>> 'email'=> array(
>>                     'mustNotEmpty'=>array(
>>                         'rule' => 'notEmpty',
>>                         'message'=> __('Please enter email'),
>>                         'last'=>true),
>>                     'mustBeEmail'=> array(
>>                         'rule' => array('email', true),
>>                         'message' => __('Please enter valid email'),
>>                         'last'=>true)
>>                     ),
>>
>>
>>
>>  On Fri, Nov 2, 2012 at 7:05 PM, Chris <[email protected]> wrote:
>>
>>> hi guys,... I'm getting this preg_match Warning on Email issue no matter
>>> what I do,....
>>> can anyone help me please,....
>>>
>>> Warning (2): preg_match() [function.preg-match]: Delimiter must not be
>>> alphanumeric or backslash [APP/controllers/invitations_**controller.php,
>>> line 83]
>>>
>>> and this is what I have in a Model:
>>>
>>>     var $validate = array(
>>>       'email' => array(
>>>       'rule' => 'alphaNumeric',
>>>        'required' => true,
>>>       'allowEmpty' => false,
>>>      ),
>>>  );
>>>
>>> thanks in advance,...
>>>  chris
>>>
>>> --
>>> Like Us on FaceBook 
>>> https://www.facebook.com/**CakePHP<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 cake-php+u...@**
>>> googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/cake-php?hl=en<http://groups.google.com/group/cake-php?hl=en>
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> Chetan Varshney
>> Ektanjali Softwares Pvt Ltd
>>
>  --
> 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.
>
>
>

-- 
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