Wednesday, April 29, 2009

Re: Need little help with a validation rule

In your model you can override the save() method to check if all
fields are empty. If they are then ignore the record. If one or more
are set then call parent::save()... using the validation rule Brian
mentioned.

On Apr 29, 9:43 am, Ernesto <e.fanz...@gmail.com> wrote:
> Hello.
>
> I have a model with 5 fields
>
> model_id
> parameter_A
> parameter_B
> parameter_C
> parameter_D
>
> if none of them are set -> the model should ignore the record
> if all of them are set -> the model should save the record
> if some of them are set ->the model should return a validation error
>
> what rule can i use?
--~--~---------~--~----~------------~-------~--~----~
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: