[html-formfu] Constraint on a joined field (CompoundJoin)

Carl Franks fireartist at gmail.com
Wed Aug 20 14:38:27 BST 2008


2008/8/19 Carl Franks <fireartist at gmail.com>:
> 2008/8/18 Moritz Onken <onken at houseofdesign.de>:
>>
>> Am 02.08.2008 um 10:14 schrieb Moritz Onken:
>>
>>> Added a second test (actually renamed the first one to
>>> constraint_compoundjoin.t)
>>> repeatable_compoundjoin.t tests a join block in a nested repeatable block.
>>> I can't find the right field names.
>>>
>>> If I render the form the field names are "nested.nested.end_1.enddate_1"
>>> which is
>>> awkward. I also tried nested.end_1.enddate_1 and nested.end_1.enddate. No
>>> luck yet
>>>
>>> any ideas?
>>>
>>> both tests are in svn xt/
>>
>> Hi Carl,
>>
>> did you have a look at this test?
>
> I've gotten as far as figuring out that it's once again caused by the
> troublesome Multi element, which is a subclass of both Block and
> Field.
> I'll have another go at resolving it today.

Okay, I've fixed this in r1123

In r1124 I added a testfile which tests for what you were trying to do
in xt/repeatable_compoundjoin.t
    t/nested/elements/block_repeatable_multi_named_filter.t
    t/nested/elements/block_repeatable_multi_named_filter.yml

Note, though, there's a couple of important differences...

First, all field names within a Repeatable block get incremented, so it's not:
    'nested.end_1.enddate'
it's:
    'nested.end_1.enddate_1'

Also, param_value() (and similar methods) expect the fully resolved
nested_name as it's argument, so its not:
    param_value('end')
it's:
    param_value('nested.end_1')

If you're interested - as part of the fix for this, Multi no longers
sets is_field(0).
There's a new element method is_block() - which is true for everything
that inherits from Block.pm
is_field() is now true for everything that inherits from _Field.pm

This means that Multi is now true for both is_field() and is_block()

And the Hr element (and it's parent _NonBlock) are the only "odd"
ones, in that both these methods return false.

Cheers,
Carl



More information about the HTML-FormFu mailing list