I have done this before in (1.3) but it wasn't a pretty solution. If your using 2.2 you might want to take a look at this: http://book.cakephp.org/2.0/en/models/data-validation.html#dynamically-change-validation-rules
You could use that in the beforeValidate() callback of the model and choose what validation rules to add based on the data supplied. On Friday, June 8, 2012 10:13:31 AM UTC+2, Michael wrote: > > So I need to check that at least one field out of four is being set before > I will allow to save. The validation rule works great as long as you have > something sent to it, but since all the option fields have an empty slot, > it would be easy to pass an array with all the right bits of info for that > table except for one of the four ids. Since none of the four had data sent > to them, their validation rule never gets called and it allows it to save. > Any ideas how to get around this? I have tried to play around with the > 'required' flag, but it really doesn't seem to be what I am really looking > for since it would require all four to be set before allowing it to save. > Any ideas? Thanks in advance. > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php