[html-formfu] Repeatable prepends nested_name to element names

Ascii King tech at swattermatter.com
Tue Jan 6 19:06:41 GMT 2009


Why does my nested_name get added to the beginning of every field 
created by my repeatable element? The documentation doesn't mention 
that.  I'll give more code than I think I need to in case it is 
something I am doing.

This part of my edit.yml file:

id: form
auto_id: %n

(further down)

        - type: Repeatable
          nested_name: codename
          increment_field_names: 1
          attributes:
            class: repeating
          model_config:
            delete_if_true: deletion_marker
            new_empty_row_multi: name

          element:
            - type: Block
              tag: TR
              attributes:
                align: center

              element:
                - type: Block
                  tag: TD

                  element:
                    - type: Hidden
                      name: codename_id

                    - type: Text
                      name: name
                      constraints:
                      - type: Length
                        min: 4
                        message: Must be at least 4 characters long.

                - type: Block
                  tag: TD

                  element:
                    - type: Checkbox
                      name: deletion_marker

        - type: Hidden
          name: count
          constraints:
            - type: Range
              max: 3


Gives these results.

<div class="repeating">
<TR align="center">
<TD>
<input name="codename.codename_id_1" type="hidden" value="3" id="codename.codename_id_1" />
<div class="text">
<input name="codename.name_1" type="text" value="Piglet" id="codename.name_1" />
</div>
</TD>
<TD>
<div class="checkbox">
<input name="codename.deletion_marker_1" type="checkbox" value="1" id="codename.deletion_marker_1" />
</div>
</TD>
</TR>
</div>
<div class="repeating">
<TR align="center">

<TD>
<input name="codename.codename_id_2" type="hidden" value="5" id="codename.codename_id_2" />
<div class="text">
<input name="codename.name_2" type="text" value="Dreamweaver" id="codename.name_2" />
</div>
</TD>
<TD>
<div class="checkbox">
<input name="codename.deletion_marker_2" type="checkbox" value="1" id="codename.deletion_marker_2" />
</div>
</TD>
</TR>
</div>


Why is there the "codename." before everything? If I remove the auto_id: 
%n or change it to %r, it doesn't seem to affect anything. Am I supposed 
to set %n myself? 

I suspect that it is what is messing up my has_many writes because my 
many-to-many works.



More information about the HTML-FormFu mailing list