Friday, January 1, 2010

Re: Validate URL not working

i'd say your validation array is incorrect

'website' => array(
'RULENAME' => array(
array(
'required' => false,
'allowEmpty' => false,
'rule' => array('url', true),
'message' => '* Please enter a valid URL.',
'last' => true),
), ...

whereas RULENAME would here be "validUrl" or just "url" etc

so you missed one "level" in between
no validation at all then


On 2 Jan., 05:50, "Dave" <make.cake.b...@gmail.com> wrote:
> In my model i have:
>
> 'website' => array(
>    array(
>     'required' => false,
>     'allowEmpty' => false,
>     'rule' => array('url', true),
>     'message' => '* Please enter a valid URL.',
>     'last' => true),
>
>    array(
>     'rule' => array('checkUnique', 'website'),
>     'message' => 'This URL is already registered.',
>     'last' => true)
>    ),
>
> When I enterhttp://www.testits says that's ok. And saves the data.
>
> I have $this->User->save($this->data, true, $white); and $white is my array
> of fields to save
>
> Is there reg expression out there that works better than the cake url
> validation that anyone has come across?
>
> Any ideas?
>
> Thanks
>
> Dave

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

No comments: