[html-formfu] updates: repeatable blocks, constraint 'when' clauses

Carl Franks fireartist at gmail.com
Thu Feb 26 19:23:27 GMT 2009


A Repeatable block's repeat() method does some funky stuff, making
sure all fields' constraints, etc are properly re-parented, and also
changing any others() field list.
For example, the following config:
    - type: Repeatable
      name: bands
      elements:
        - name: foo
        - name: bar
          constraints:
            - type: Equal
              others: foo

$repeatable->repeat(1) will build a block similar to this:
    - type: Block
      elements:
        - name: 'bands.foo_1'
        - name: 'bands.bar_1'
          constraints:
            - type: Equal
              others: 'bands.foo_1'

* change 1 *

This has now been updated so it correctly handles items in the
others() list of both short names and full nested-names.
    others: ['foo]
or
    others: ['bands.foo']

btw, this is a good thing, because in all other circumstances, the
others() list *must* only contain the full nested-name, so it's
probably a good habit only to use nested-names.

Support for short names will probably be deprecated at some point, but
there's no rush for that. I'll probably just update all doc examples
for now to use the full nested-names.

* change 2 *

It's also been fixed, so any 'when' clauses now also get their 'field'
name updated.

* change 3 *

plugins attached to fields inside a Repeatable block now also get
properly re-parented.

* change 4 *

this one's unrelated to repeatable blocks.
A constraint's 'when' clause no longer required a 'value' or 'values'
argument. In the case that neither are set, the constraint is run if
the applicable field has a true value.

Cheers,
Carl



More information about the HTML-FormFu mailing list