I have the following setup:  Class Observation hasMany Marks.
The Marks Class only has one relevant field: mark_number
I am working on the add form for my Observations, and the problem is
that I do not know in advance how many Marks a given observation will
have.  I initialize the form with one mark field called data['Marks']
['mark_number0'], and then if the user has multiple marks he can click
on a "add another mark" link which dynamically creates a new field
data['Marks']['mark_number1'] and so on.
So far so good.  My problem comes to dealing with data validation.
First, I need to check that each mark_number is unique and doesn't
already exist in the database and if not I need to invalidate the
field.  I would like to put the validation routine inside my Mark
model, but it only has a single field mark_number, and not
mark_number0, etc, so I cannot invalidate the appropriate field there.

I can code all of this by hand, but it is ugly and feels wrong as if I
am not taking advantage of all the cakey goodness.  What is the best
practice way to deal with this situation.

Thanks for any advice


--~--~---------~--~----~------------~-------~--~----~
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