This is a simple thing but I don't think it's currently supported...
Running 'cake bake view' (or 'cake bake all' in my specific case)
creates add and edit view files with lines such as:
echo $form->input('contact_id');

When the value (e.g. 'contact_id') is a foreign key for an another
object in a HasMany relationship with the object being added or
edited, a html select form element is created (HABTM relationships
always get 'select multiple' elements which always allow selecting
none of the options). Unfortunately with these select elements one of
the options is always selected, which can be rather annoying,
particularly when I am just starting to populate a database. That
being said, I can see (and have) many normal use cases where I'd like
to have the value be NULL. So, it'd be great if there was always a
blank (ie NULL) option added to the select options. If I update the
actual database tables and set the relevant row to NULL, Cake handles
it just fine.

Looking at the manual, the $option['empty'] for $form->input() looks
like it does the trick: http://book.cakephp.org/view/201/options-empty.
So, do people think it would be unreasonable to make this part of the
default functionality of $form->input() for HTML form selects? Or at
least have cake bake output something like this: $form-
>input('contact_id', , 'empty' => __('None')))?

What do you think?

--~--~---------~--~----~------------~-------~--~----~
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