Hi folks,

After evaluating Cake for a rather large back office application I
think I've fallen in love, yet something still mystifies me regarding
the formHelper.

Say I have two models (Campaign and Offer),

Campaign -> hasMany -> Offer
Offer -> belongsTo -> Campaign

When editing a campaign record I merely pass the field name argument
to the form input helper and bingo, my edit campaign form is good to
go with the save() method.

This is perfect and works like a charm. Flattery precedes a question
so I won't let you down ;)

Say I wanted to have the campaign fields ready to edit, and also
fields for all of the offers that belong to that campaign, all on one
form? I know saveAll() will work once I get to the controller, but the
view?

I've gone down a road that I am quickly discovering is wrong. What I
had done in my controller was grab the offers with a find('all') (with
more restrictive conditions than that defined in the Campaign models'
hasMany definition) and sent that to the view, and looped through to
create the individual fields, however I quickly discovered that the
form helper had it's own set of offers it was working from. This was
causing an issue as sometimes what I was iterating wasn't the same
record as that the formHelper was.

If I pass the form input helper the 'Modelname.n.fieldname' string, I
get the data out all fine and dandy - Wow, the form helper really is
cool, but where the confusion lies is how do I know how many offers,
or ultimately how many repetitions I need to loop through the input
helpers for each offer?.


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