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

Moritz Onken onken at houseofdesign.de
Fri Jul 25 15:22:05 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: has_many_repeatable_many_new.yml
Type: application/octet-stream
Size: 487 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20080725/0e59b33b/has_many_repeatable_many_new.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: has_many_repeatable_many_new.t
Type: application/octet-stream
Size: 1530 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20080725/0e59b33b/has_many_repeatable_many_new-0001.obj
-------------- next part --------------



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} )
         {



More information about the HTML-FormFu mailing list