If your model is named A, then your data structure should be:
[code]
$this->data[A][email] = 'aa';
$this->data[A][url] = 'www.aa.com';
[/code]
And your validation rules for the A fields, should be:
[code]
var $validate = array(
'email' => array(
'rule' => 'email',
'message' => 'Please correct your e-mail address'
),
'url' => array(
'rule' => 'check_url',
'message' => 'Please correct your internet address'
)
);
[/code]
Please do read the CakePHP chapter on validation, at:
http://book.cakephp.org/view/125/Data-Validation
Enjoy,
John
On May 20, 7:39 pm, emanuele <[email protected]> wrote:
> hello cakers,
>
> I m stucked with a simple issue regarding data validations. Suppose that I
> ve a model named A:
> After I submit data, my $this->data would be so composed.
>
> eg
> $this->data[A][B][email] = 'aa';
> $this->data[A][B][url] = 'www.aa.com';
>
> I wanto to check both fields. In model i ve defined
> var $validate = array(
> 'B' => array(
> 'rule' => 'check',
> 'message' => 'error'
> )
> );
>
> fuction check() {
>
> }
>
> When check returns false only the 'e' of error it is printend... when am I
> wrong?
> Secondo question. Is there any possibility to customize the error message,
> one different for email and url eg?
>
> thanks in advance and sorry for the newb questions.
> --
> Emanuele Gringeri
> Computer Engineer
> University of Pisa
> Be my mirror, my sword and shield
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> athttp://groups.google.com/group/cake-php?hl=en
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en