call validation on single field

2007-08-23 Thread Claudia

Hi there

Is there a way to ask Cake to validate only a single field (opposed to
validating all fields that are mentioned in the $validate array) ?

I use a model without a table to make use of the validation features
of cake when sending an email. Now I would like to validate an array
of email addresses but the validation rule works only on single email
addresses. Therefore I thought about writing a custom validation rule
that iterates through the array and validates each email address on
its own but I don't know how to call the Cake validation for emails
manually.
Also sometimes I want to validate only a few fields whereas another
time I would like to validate all fields. This could be easily
achieved if it is possible to tell Cake which fields to validate.

I am using Cake 1.2

Thanks

Claudia


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: call validation on single field

2007-08-23 Thread Grant Cox

if ( !preg_match(VALID_EMAIL, $email_address) ){
// not a valid email
}

will manually check a single email address.

On Aug 24, 8:27 am, Claudia [EMAIL PROTECTED] wrote:
 Hi there

 Is there a way to ask Cake to validate only a single field (opposed to
 validating all fields that are mentioned in the $validate array) ?

 I use a model without a table to make use of the validation features
 of cake when sending an email. Now I would like to validate an array
 of email addresses but the validation rule works only on single email
 addresses. Therefore I thought about writing a custom validation rule
 that iterates through the array and validates each email address on
 its own but I don't know how to call the Cake validation for emails
 manually.
 Also sometimes I want to validate only a few fields whereas another
 time I would like to validate all fields. This could be easily
 achieved if it is possible to tell Cake which fields to validate.

 I am using Cake 1.2

 Thanks

 Claudia


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---