[html-formfu] Fwd: Model::DBIC: creating many new rows

Moritz Onken onken at houseofdesign.de
Fri Aug 1 10:48:36 BST 2008


>
> Hi,
>
> referring to this post:
>
> http://lists.scsys.co.uk/pipermail/html-formfu/2008-April/001158.html
>
> I created the following patch which allows the user to specify a  
> new_empty_rows config option.
> This allows the user to add as many new rows as he wishes. He can  
> still restrict it by putting
> a constraint on the count field.
>
> Test  
> attached 
> .<has_many_repeatable_many_new.yml><has_many_repeatable_many_new.t>
>
>
> What do you think?
>
> cheers,
>
> moritz
>
> Index: lib/HTML/FormFu/Model/DBIC.pm
> ===================================================================
> --- lib/HTML/FormFu/Model/DBIC.pm       (revision 1086)
> +++ lib/HTML/FormFu/Model/DBIC.pm       (working copy)
> @@ -37,7 +37,7 @@
>
>        return _merge_hashes( $config, $dbic );
>    }
> -
> +    #$config->{new_empty_row} ||= $config->{new_empty_rows};
>    return $config;
> }
>
> @@ -474,7 +474,7 @@
>        my $row;
>
>        if (   ( !defined $value || $value eq '' )
> -            && $i == $max
> +            && ($i == $max || $config->{new_empty_rows})
>            && $config->{new_empty_row} )
>        {
>

Ping




More information about the HTML-FormFu mailing list