[html-formfu] Dynamic Form Elements....

Carl Franks fireartist at gmail.com
Thu Dec 18 08:28:20 GMT 2008


2008/12/18 Johannes <list100 at hoerburger.org>:
> Hi guys,
> trying to create form elements that are not in the formconfig.yml I
> succeeded creating and rendering them to the page, but they don't arrive on
> submit. Any idea if something like that may be possible?

Hi Johannes,

After submission, you need to make sure you're adding all the dynamic
fields again, before calling process(), as FormFu will only allow
values that correspond to known fields.
I would normally handle this by writing a Plugin subclass that has a
process() method which adds the dynamic fields. This'll mean the
fields are present when FormConfig() calls $form->process().

Otherwise, you'll have to do something like this:

    sub edit : Chained('foo') : PathPart : Args(0) : FormConfig {
        my ( $self, $c ) = @_;

        my $form = $c->stash->{form};

        $self->_add_dynamic_fields( $form );

        $form->process();

        if ( $form->submitted_and_valid ) {
            # ...
        }

        return;
    }



More information about the HTML-FormFu mailing list