[html-formfu] How to save repeatable fields inserted by javascript

cosmin at sns.ro cosmin at sns.ro
Fri Feb 20 09:24:11 GMT 2009


Hello all,

I have a form with initialy 1 repeatable element.

   ---
   elements:
     - type: Hidden
       name: count
       value: 1
     - type: Block
       elements:
         - type: Repeatable
           counter_name: count
           nested_name: profiles
           model_config:
             new_empty_row_multi: name
           elements:
             - type: Hidden
               name: profile_id
             - type: Text
               name: name
               label: Name


To that Repeatable element, I am adding from javascript, another "row".
This is done by copying the existing last row, incremending the input
names(profiles.profile_id_2, profiles.name_2) and count.

In my controller:

    $form->process( $c->req->params );
    return unless $form->submitted_and_valid;
    $form->model->update( $some_db_row );

The problem is that only the initial existing "row" from that Repeatable
element is saved. The ones I add from js are ignored.

What am I doing wrong here?


Best regards,
Cosmin





More information about the HTML-FormFu mailing list