[html-formfu] Subforms show up as text fields

Carl Franks fireartist at gmail.com
Fri Mar 6 12:10:32 GMT 2009


2009/3/5 Ascii King <tech at swattermatter.com>:
> I solved it, if anyone needs to know. I checked out the tests and found the
> test for the load_config_file.  I needed to add something that accepted an
> elements list, like a Block or else it misunderstood whatever config file I
> called.
>
> #main.yml
> ---
> elements:
>
>  - type: Block
>   load_config_file: prior/test_sub_appointment.yml

I'm glad you got it solved, but your description of the solution isn't
really right.

There are 2 changes from your original post that you made, that were needed.

The top-level config-file was wrong:
    ---
    indicator: submitted
    elements:
     load_config_file:
      - prior/submit_data.yml

because that's equivalent to:
    $form->indicator('submtited');
    $form->elements({
        load_config_file => [ 'prior/submit_data.yml' ],
    });
but 'load_config_file' isn't an argument that elements() understands.

Also, the 'elements:' line in the included config-file was needed.
This meant that load_config_file() was returning a hash-ref { elements
=>  \@elements }
rather than just the \@elements.

load_config_file() doesn't need to be called on a Block - Your
top-level config-file is allowed to contain just:
    load_config_file: 'x.yml'

because that is equivalent to:
    $form->load_config_file( 'x.yml' );
which is perfectly ok.

So, to summarize... :)

A config file must contain a hash-ref of method-names / arguments to
be called on the form, element, or processor that load_config_file()
was called on.

load_config_file() is just a formfu method, so can't be inserted just
anywhere in the config-file.
It's not equivalent to TT's [% INCLUDE %] directive.

Cheers,
Carl



More information about the HTML-FormFu mailing list