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
[email protected]
http://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 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 [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
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 [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