[html-formfu] Question about load_config_files and order of
elements
Carl Franks
fireartist at gmail.com
Tue May 15 11:48:52 GMT 2007
On 13/05/07, Andreas Marienborg <omega at palle.net> wrote:
> I have a few questions though. As far as I can understand, one is
> supposed to be able to split a form over several config-files? How does
> one maintain order of fields in such an event?
>
> I tried the following two files, which ends up putting the elements from
> the included file first:
> #forms/message_compose.yml
> ---
> auto_fieldset: 1
> elements:
> - type: select
> name: to
> label: To
> constraints:
> - Required
>
> load_config_file: forms/message.yml
>
> #forms/message.yml
> ---
> indicator: title
> auto_fieldset: 1
> elements:
> - type: text
> name: title
> label: Subject
> constraints:
> - Required
> - type: textarea
> name: body
> label: Body
> - type: submit
The YAML is converted to an unordered perl hash - not a list - but
load_config_file() does accept an array of values, so you could do
either of these:
#forms/wrapper.yml
---
auto_fieldset: 1
load_config_file:
- forms/message_compose.yml
- forms/message.yml
OR
#forms/wrapper.yml
---
auto_fieldset: 1
elements:
- type: block
load_config_file: forms/message_compose.yml
- type: block
load_config_file: forms/message.yml
> also, is it possible to make it (at least when using the controller base
> class) so that I can load_from_config: message, so it is more consistant
> with how the base-class loads config files?
Lets see what gets decided in the other thread first ;)
But, yes, a new option for HTML::FormFu to allow this would be a good idea.
Carl
More information about the HTML-FormFu
mailing list