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


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to