You need to specify that the website field is allowed to be empty
(specifying required => false isn't enough):

'website' => array(
    'rule' => 'url',
    'required' => false,
    'allowEmpty' => true,
    'message' => 'This doesn\'t look like a website to me'
)


- Jamie

On Aug 4, 10:32 am, Luis Alvarez <iamchi...@googlemail.com> wrote:
> Hi everyone,
> I have a form where a user can enter a URL. If the user leaves the URL
> field empty and presses save, the cakephp URL validator  complains.
>
> This is my code in the model
>
> var $validate = array(
>                         'email' => array('emailRule1' =>
> array('rule'=>'email','required'=>true, 'message'=>'Incorrect email'),
>                                          'emailRule2' => 
> array('rule'=>'notEmpty','required'=>true,
> 'message'=>'Please provide an email'),
>                                          'emailRule3' => 
> array('rule'=>'isUnique','required'=>true,
> 'message'=>'There already is an account with this email ')),
>                         'password' => array('passwordRule1' =>
> array('rule'=>'notEmpty','required'=>true, 'message'=>'Password cannot
> be empty', 'last'=>true)),
>                         'website' => array('rule'=>'url','required'=>false,
> 'message'=>'This doesn\'t look like a website to me')
>                         );
>
> Is there a problem with the validator? Am I overseeing something?
>
> Any help?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to