[html-formfu] HTML::FormFu::Element::DateTime

Вячеслав Тихановский viacheslav.t at gmail.com
Mon Jan 21 18:10:18 GMT 2008


2008/1/21, Carl Franks <fireartist at gmail.com>:
> On 17/01/2008, Вячеслав Тихановский <viacheslav.t at gmail.com> wrote:
> > Hello.
> >
> > I wanted to write DateTime element based upon Date, and ran into some problems.
> > Everything is ok with getting the field values from the form, and save_to_model
> > also works fine. But when i use get_element('name')->value('12-12-2007 10:10')
> > or defaults_from_model everything gets filled except the time param.
> >
> > Could you please show me where i got an error. Here is my class:
>
> I tweaked t/elements/date.t to use Element/DateTime.pm instead - and
> got lots of errors.
> I also had to make some changes to Element/Date.pm to get it working,
> as it was calling some internal subroutines -  had to switch them to
> method calls instead.
> Attached are the relevant files - can you check if it works as
> expected? - as I haven't tested it with defaults_from_model() at all.

Works good. Thanks a lot. Tests are ok too.

But do I have to manually write constraint or something like that?
Because 31 of February works now and it adds to my db 0000-00-00
00:00:00 and the next time I do defaults_from_model it says wrong date
format.

Invalid date format: 0000-00-00 00:00:00 at
/usr/lib/perl5/vendor_perl/5.8.8/i686-linux/Template/Service.pm line
94

Another question is why it comes up in Template Toolkit...


More information about the HTML-FormFu mailing list