[html-formfu] Can only delete first row in has_many, can't figure out why

Leanan Sidhe the.leanan.sidhe at gmail.com
Fri Mar 20 20:02:58 GMT 2009


I've attached a copy of my config.  This config gets loaded by a main
config.  As far as I can tell I have it right.  I've also tried the
following:

Moved the my_counter in so that it's in the Repeatable group.  This
results in foobar.baz.my_counter_1, foobar.baz.my_counter_2, etc, and
that doesn't seem right.
Moved the my_counter directly beneath the first elements.  This
results in that field never being rendered.
Moved the my_counter under another nested_name: baz element, so that
its name is foobar.baz.my_counter (instead of foobar.my_counter, which
is the name it gets in the config below)
Moved the my_counter under another nested_name: baz element (as
before) but also set the counter_name to be baz.my_counter

I looked at the code, particularly the _delete_has_many, and it looks
like what I have below is proper (also based off the
has_many_repeatable_delete_true.yml file in the \t\update directory).

I'm very confused.  I can't delete anything but the first row.  I've
read of another user having this issue, but that was because they
didn't have the counter_name part.  As soon as they set counter_name,
it worked, and I have that set.

For those curious, my schema is the following:

Form might_have foobar
Foobar has_many baz
Baz belongs_to Foobar

There's got to be something very subtle missing / wrong, and I've
spent so long looking at it that I can't figure it out.  I hope that
someone can spot my error and let me know what it is.

---
  elements:
    - type: Block
      nested_name: foobar
      elements:
        - type: Block
          tag: table
          elements:
          - type: Block
            tag: thead
            elements:
              - type: Block
                tag: tr
                elements:
                  - type: Block
                    tag: th
                    content: Column 1
                  - type: Block
                    tag: th
                    content: Column 2
                  - type: Block
                    tag: th
                    content: Column 3
          - type: Block
            tag: tbody
            elements:
              - type: Repeatable
                nested_name: baz
                counter_name: my_counter
                elements:
                  - type: Block
                    tag: tr
                    elements:
                    - type: Block
                        tag: td
                        elements:
                          - type: Checkbox
                            name: deletion_marker
                            model_config:
                              delete_if_true: 1
                    - type: Block
                        tag: td
                        elements:
                          - type: Text
                            name: column1
                    - type: Block
                        tag: td
                        elements:
                          - type: Text
                            name: column2
                    - type: Block
                        tag: td
                        elements:
                          - type: Text
                            name: column3
                    - type: Block
                        tag: td
                        elements:
                          - type: hidden
                            name: id
              - type: Hidden
                name: my_counter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090320/7b=
334421/attachment.htm


More information about the HTML-FormFu mailing list