[html-formfu] setting default values

Carl Franks fireartist at gmail.com
Sat Oct 17 20:12:36 GMT 2009


2009/10/15 Ascii King <tech at swattermatter.com>:
> Moritz Onken wrote:
>>
>> From a first glance:
>>
>> $c->stash->{object} is not a formfu object but a DBIC row.
>> You might want to try $c->stash->{form}
>>
>
> Thanks, Moritz.  Changing that line changes the error.
>
> $c->stash->{form}->model->default_values( { name => "tbz" } );
> $c->stash->{form}->process();
>
> |"Can't call method "can" on unblessed reference at
> /usr/local/share/perl/5.8.8/HTML/FormFu/Model/DBIC.pm line 198."|
>
>
> Is it because the form isn't created until the process() is called? Does
> anyone have some complete examples of loading default values? I have looked
> through the tests, but they all use the same format and it isn't working for
> me.

Ah, I thought at first you were using HTML::FormFu::Model::HashRef -
but I see from the error message it's HTML::FormFu::Model::DBIC.

I think you're really just wanting the core form method - not the
method on model():

    $form->default_values({ \%vals });

Carl



More information about the HTML-FormFu mailing list