Hi Bakers,

I want to get your opinions on the best approach to a feature i need.

I have a model, who's table has a field called full_details  (enum
with Y, N ).
If the row has this set to N, only a few of its fields need to be
validated  - if it's set to Y, most fields require validation.

My current thinking is to change the model's beforeValidate callback,
which looks at the current record/details for the new record, and if
full_details='Y', it dynamically add new validation rules to the model
- i.e something like

$this->validate['field_name']='VALID_NOT_EMPTY'  //do this for various
fields

The model's standard validation would then pick this up.

Is this a good approach? Are they any 'gotchas' about it?
Are there others approaches I haven't thought of?

Thanks in advance,

Woody


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to