hey Woody,

I don't know if I'm the right person to answer your question but... I
can't see anything wrong with your method. I might think about keeping
all my validation rules in my model and simply removing those that
aren't required (in beforeValidate). Same thing at the end of the day.

HTH,
mikee

On 19/02/07, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> 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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to