[html-formfu] Date element set value

Carl Franks fireartist at gmail.com
Mon Aug 13 11:13:52 GMT 2007


On 13/08/07, Tobias Kremer <list at funkreich.de> wrote:
> Carl,
>
> is it correct, that it's currently completely impossible to set a value for the
> newly introduced date element? I tried the following variations and none of them
> seems to work:
>
> 1. $form->get_field( { name => 'birthdate' } )->value( '1977-07-07' );
> 2. $form->get_field( { name => 'birthdate' } )->value( DateTime->now() );
> 3. $form->get_field( { name => 'birthdate.year' } )->value( '1977' );

At the moment, the only way is to use the month_default(), etc. methods.
Never try to change the sub-selects by retrieving them from the form -
because they are deleted and rebuilt for every $form->process() and
$form->render() - losing your changes.

I plan on making a more consistent way to make changes soon.

Carl



More information about the HTML-FormFu mailing list