Try something like this (assuming you're using the standard array
conventions for your data):
<?php
foreach ($this->data['Education'] as $key => $value) {
echo $form->input('Education.'.$key.'.id');
echo $form->input('Education.'.$key.'.some_other_field_name');
}
?>
That'll loop through the Education array for the User you're dealing
with and properly format the form fields. Don't forget to use saveAll
() when saving the data in your controller.
- Jamie
On Aug 6, 3:13 pm, "Dave Maharaj :: WidePixels.com"
<[email protected]> wrote:
> Thanks,
>
> But say User 1 has 3 Educations and User 2 has only 1 how do you build the
> form dynamically so there are fields for each Education?
>
> Dave
>
> -----Original Message-----
> From: thatsgreat2345 [mailto:[email protected]]
> Sent: August-06-09 7:36 PM
> To: CakePHP
> Subject: Re: Curious how to question
>
> Just use the correct conventions, taken right from the form naming
> conventions in cakephp docs
>
> <?php
> echo $form->input('Modelname.0.fieldname');
> echo $form->input('Modelname.1.fieldname');
> ?>
>
> <input type="text" id="Modelname0Fieldname" name="data[Modelname][0]
> [fieldname]"> <input type="text" id="Modelname1Fieldname"
> name="data[Modelname][1] [fieldname]">
>
> On Aug 6, 2:11 pm, "Dave Maharaj :: WidePixels.com"
> <[email protected]> wrote:
> > Just wondering how to go about something like this...
>
> > User hasOne Resume hasMany Educations
>
> > Now normally you click edit/education_id and it loads 1 form to edit
> > that specific education.
>
> > What if you wanted to have 1 form that loaded all the educations on 1
> > page so you could edit them all at once.
>
> > Does that make sense?
>
> > Dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---