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

Mario Minati mario.minati at googlemail.com
Mon Nov 5 22:25:13 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 found a bug in populate_from_formfu

        if ( $checkbox{$col} && !defined $value && !$is_nullable ) {
            $dbic->$col( $col_info->{default_value} );
        }
        elsif ( defined $value || $checkbox{$col} ) {
            $dbic->$col($value);
        }

It needs to be 
	$checkbox{ $field->nested_name } 
instead, which will only work if we sort out $field == undef before.

Is 
	next unless defined $field;
ok?

Greets,
Mario



More information about the HTML-FormFu mailing list