This almost works for me - it fails if you have additional models
called in the $uses array of the controller. Cake ends up putting the
name of the first model in the uses at the front of those form field
names.

So if I have another model called ListItem which I use to pull generic
list items into controllers, when I do Chater[0][paragraph][0][field],
it outputs ListItemChapter[0][paragraph][0][field] as the name
property for the form element.

On May 12, 5:46 am, francky06l <[EMAIL PROTECTED]> wrote:
> For this type I use a kind of "hack" in the field names :
>
> echo $form->input('Chapter/0][paragraph][0][field]', ... )
>
> That does the trick, but I did not check so many levels in the
> controller .. ie : be sure to check that $this->data is correct.
>
> hth
>
> On May 12, 2:26 am, James K <[EMAIL PROTECTED]> wrote:
>
> > Having the exact same issue here - looks like Cake simply doesn't
> > support hasMany past one level with the dot notation.
>
> > On Apr 18, 8:41 am, Max Romantschuk <[EMAIL PROTECTED]> wrote:
>
> > > I'm working on a form for a three-levelhasManyrelationship.
> > > Conceptually: BookhasManyChapterhasManyParagraph. (Model names for
> > > illustrative purposes.)
>
> > > I'm using the form helper to render my form. The main parent model
> > > (Book) stuff works fine, and I can do the Chapters by supplying
> > > "Chapter.0.field", "Chapter.1.field" etc. to the form helper. The
> > > fields are populated nicely, and the inputs are named data[Chapter][0]
> > > [field], data[Chapter][1][field] etc.
>
> > > However, when I try giving the form helper the next level with
> > > "Chapter.0.Paragraph.0.field" that won't work and Cake falls back to
> > > the parent Book model, naming the input data[Book] and breaking the
> > > form. I'm sure I could get the data to populate with "Paragraph.
> > > 0.field", but then I'd have no clue which paragraph goes in which
> > > Chapter after the form is submitted.
>
> > > Has anyone gotten Cake to populate a three-levelhasManyrelationship
> > > like this? Doing the third level manually is pretty trivial in this
> > > case, it's only two fields of data, so maybe I should just do that?
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to