(Using Cake 1.2 RC3, and tried latest nightly,
1.2.x.x_20.10.2008.tar.gz)
When using the FormHelper on fields that generate a select list, there
is an option to use " 'empty'=>true" (or to swap out "true" for a
string literal that is used as the textual label in the select box).
Date, datetime, and time fields (I'm using MySQL) all are rendered as
select boxes, for this example, ALL fields were set to ALLOW null
values.
When applying the 'empty' option to all three of these data types in
both the add and edit views, my results are as follows:
1. Add form
- everything works as expected
2. Upon saving
- The database stores null value for date, and datetime types.
`time` is stored as '00:00:00'.
3. Viewing the edit form
- `date`, and `datetime` fields are still shown (and selected by
default) as the empty value(s)
- `time` is set to 12:00am, but the FormHelper still shows an
option for an empty selection, so at least it's rendering the select
box properly.
I've not yet tracked back where the transform happens (from an empty
value to what I think is an invalid SQL value for a time field), but I
don't know if this is intended behavior or not. I do require the
ability to save an empty value, or at the very least show an empty
value on the edit form, but I can't seem to find a workaround.
Does anyone have any advice or comments?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---