On Thu, Dec 1, 2011 at 17:21, Rippl, Steve <rip...@woodlandschools.org>wrote:

> I have a form that has some "static" fields that are both inherited from
> another form and then some more added via has_field in the general
> declaration of the thing.  I then have a bunch more very repetitive fields
> I'd like to add dynamically as I could build the set of fields and then
> loop through enough times just changing the names as I go along.  Is this
> possible?  I've seen examples of adding to the field list via process in
> the Controller, but I'd like to put this in a sub within the Form.pm file
> so as not to clutter up the controller.
>
> Just coming over to this from HTML::FormFu and it seems pretty impressive
> just how much is in FormHandler!
>

I've done this two ways. First was to create a shared .yml configuration
file and include it into the others via the `load_config_file` directive.

When I wanted something a little more intelligent/configurable I created a
custom Element that extends Element::Multi and creates the wanted
sub-fields `after process`.

This custom element and it's configuration is included in the *.yml for the
form.

I found creating the fields in the controller makes it more difficult to
set and check constraints, perform CSS styling based on class name (element
FOO wants class foo not text), etc.

regards,

Rod
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to