2009/1/9 Jens Schwarz <blacky6...@gmx.de>: > Hi, > > I have a problem with the hour selectbox of the DateTime element introduced > in 0.03006: I use the DateTime element to represent a datetime column in my > mysql db. My yml's look like this (one for creating a record, one for editing > a record): > > (...) > - type: DateTime > name: mydatetime > label: mydatetime > year: > prefix: "-year-" > month: > prefix: "-month-" > day: > prefix: "-day-" > hour: > prefix: "-hour-" > minute: > prefix: "-minute-" > strftime: "%Y-%m-%d %H:%M:00" > (...) > > (I hope I use the strftime parameter correctly to produce YYYY-MM-DD > HH:MM:00.) > So what I detected is, that if I edit a record and in my db is a datetime > like "2009-01-09 07:50:00", the FormFu form shows: > "2009" "01" "09" "-hour-" "50" where I would expect "2009" "01" "09" "07" > "50". > If on the other hand the db record is "2009-01-09 17:50:00", FormFu correctly > produces the selectboxes "2009" "01" "09" "17" "50". > Is this a bug in the FormFu DateTime element or am I using this element in > the wrong way?
Although it's a rather unusual behaviour you're seeing, this is down to the old requirement that any changes to the form mean you need to call $form->process() before rendering the form. "changing the form" includes the case of calling $form->model->default_values() Although most elements are simple enough that you can get away with not doing it, the Date + DateTime elements are rather more complex, and need process() called to ensure they're properly setup. I'll need to update the docs to make this more clear, as the only place I can currently find it documented, is in the docs for $form->default_values(), and a rather incomplete explanation in $form->process(). Carl _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu