[html-formfu] defaults_from_model doesn't call deflators

Moritz Onken onken at houseofdesign.de
Tue Feb 5 13:35:23 GMT 2008


Thanks Carl,

just works (tm)!


Am 05.02.2008 um 14:27 schrieb Carl Franks:

> On 05/02/2008, Moritz Onken <onken at houseofdesign.de> wrote:
>> I create JSON with:
>>
>>
>>        my $form = HTML::FormFu::ExtJS->new; #HTML::FormFu::ExtJS  
>> adds some
>> functionality but inherits from FormFu
>>        $form->load_config_file('someconfig.yml');
>>        my $rs = $c->user->some_relationship->find($id);
>>        $form->defaults_from_model($rs);
>>        my $base = $form->get_all_elements;
>>        $c->stash({success => 1});
>>        $c->stash->{data}->{$_->name} = $_->default for(@{$base});
>>        $c->forward($c->view(""JSON"));
>
> for my $field (@{ $form->get_fields }) {
>    my $data = $field->render_data;
>
>    $c->stash->{data}->{ $data->{nested_name} }
>        = $data->{value};
> }
>
> Up until a couple months ago, before the removal of the Render object
> - the only supported way to *output* anything, or use any part of the
> form for output was with the Render object returned by
> $form->render();
>
> Now, it's a little less clear, because render() returns a string - but
> if you're not using one of the current output methods - render(),
> string() or tt() - you should use render_data() - these are the only
> supported ways of using the form for output.
>
> Carl
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.rawmode.org
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu




More information about the HTML-FormFu mailing list