Wednesday, July 28, 2010

Re: CakePHP 1.3 Form Helper creating drop down and not input field

This works for:
echo $form->input

But not:
echo $this->Form->inputs

Any way it will work with the latter?

On Jul 17, 6:41 am, spheroid <kevinsawi...@gmail.com> wrote:
> The "'type' => 'text'" worked, thanks Jeremy! I wanted all to be
> inputs. Perfect.
>
> On Jul 16, 2:29 pm, Miles J <mileswjohn...@gmail.com> wrote:
>
>
>
> > Exactly what Jeremy said. I actually ran into this problem yesterday,
> > I resolved it by just putting "type" => "text".
>
> > Sometimes I love Cakes automagic-ness, sometimes it can be quite
> > annoying.
>
> > On Jul 16, 7:34 am, Jeremy Burns | Class Outfit
>
> > <jeremybu...@classoutfit.com> wrote:
> > > The form helper will automatically create a drop down is there is a variable that is a plural of a field name without it's '_id' at the end.
>
> > > For example, if you set a variable called $towns in your controller populated by $this->Town->find('list'); and then have a form input called town_id, Cake will link them up and make a drop down called town_id populated with the contents of the $towns array.
>
> > > I can only presume that you have one such variable that matches a field name, and the rest don't.
>
> > > What is your desired outcome? Should they all be drop downs (in which case you'll need to set the array variables in your controller) or should they all be inputs (in which case you should add the 'type' => 'text' option to your form input).
>
> > > Jeremy Burns
> > > Class Outfit
>
> > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > On 16 Jul 2010, at 15:14, spheroid wrote:
>
> > > > I have a database table that contains child records of another table
> > > > and want users to be able to change those child records. The form
> > > > helper is doing something strange. I have it loop through my fields
> > > > which are varchar, and for some reason one field is creating a select
> > > > drop down, all others an input. Why is this happening and how can I
> > > > fix it?
>
> > > > Portion of my view:
>
> > > > echo $form->input($somestring['MyTableName']['fieldname'], array(
> > > >                    'div' => false,
> > > >                    'label' => $somestring['MyTableName']
> > > > ['fieldname_text'],
> > > >                    'before' => '<tr><td style="width:250px;">',
> > > >                    'between' => ': *</td><td>',
> > > >                    'after' => '</td></tr>',
> > > >                    'size' => 65,
> > > >                    'default' => $somestring['MyTableName']['setting']
> > > >                    ));
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers with their CakePHP related questions.
>
> > > > 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
> > > > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: