Sweet! Thanks for sharing this, it should probably be added to the
official manual or something..
On Dec 8, 2:14 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,
> This is just a small thing but I did not find a mention of it in the
> manual. I found this out today, after a few years of using Cake :)
>
> I want a form input to have the name Modelname[][fieldname] so that I
> can post an array of "fieldname" values. The manual only mentions
> creating these "hard coded" as Modelname.0.fieldname => Modelname[0]
> [fieldname] and then incrementing the number.
>
> The reason I like the "empty" version is that is makes for a lot
> simpler javascript when I want to create these additional fields on
> the fly in the GUI and don't know how many I will need at the time of
> rendering the form on the server.
>
> Then I tried this (half by accident):
>
> $form->input('Modelname. .fieldname'); // notice the space between the
> dots
>
> Voila! The form has the empty space in the field name but Cake creates
> the array of values just the way Iike it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---