[html-formfu] DBIx-Class-HTML-FormFu nested-params

Mario Minati mario.minati at googlemail.com
Mon Nov 5 22:06:40 GMT 2007


On Monday 05 November 2007 17:59:19 Carl Franks wrote:
> I've added support for nested-params toDBIx-Class-HTML-FormFu.
>
> To use it, you must provide a 'nested_base' key:
>
> $row->fill_formfu_values( $form, { nested_base => 'foo' } );
>
> This will only look at fields/values attached to the Block element
> with nested_name 'foo'.
>
> I've also checked in experimental extended support for relationships,
> but this _will_ be changing, so probably best to just ignore that for
> now.
>
> If you want to run the DBIC tests, the db schema's changed, so you'll
> have to delete your "t/test.db" file and create another by running
> `sqlite3 t/test.db < t/create.sql`

I think there is a problem in your rewritten code for populate_from_formfu:

If you have a form that only shows part of the columns, you force the unused 
columns to undef.
That might change db entries in an unexpected way.

        my $value = defined $field
            ? $form->param( $field->nested_name )
            : ( grep { $col eq $_ } @valid )
                ? $form->param( $col )
                : undef;

I would suggest to do
	next unless defined $field;
instead.

Greets,
Mario



More information about the HTML-FormFu mailing list