[html-formfu] defaults_from_model doesn't call deflators

Moritz Onken onken at houseofdesign.de
Tue Feb 5 10:54:34 GMT 2008


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"));

After fixing the DBIC inflator problem (see catalyst list) I see that  
default actually deflates my value.
Is this behaviour correct?
>
> ... Has the form already been submitted? Do we use the default value,
> or the submitted value.

see next

>
> ... Is render_processed_value() set?

If there is an error in the submitted form, my controller returns a  
JSON string which only contains the errors and the name of the fields  
they apply to. -> No need for render_processed_value

>
> ... Creating element IDs from auto_id()

No need for auto_id with ExtJS

>
> ... Date and SimpleTable elements won't work properly if render_data()
> isn't called.

I overwrote some of these elements to fit the ExtJS specs

>
>
> I'm sure there must be other issues I can't think of, off hand ;)
>
> If you don't want to switch yet from just using $form, you could
> probably get away with just doing:
>    $field->render_data->{value};
>
> 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