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

Johannes list100 at hoerburger.org
Thu Dec 18 19:41:48 GMT 2008


Thank you for the solution Carl!

After puzzling a bit it works now the second way you proposed.

Though the "Chained('foo') :PathPart :Args(0)" part wasn't necessary...

Just did as you told me, added the elements before checking if  
submitted or not, then processed, then checked for submitted or not  
and if not submitted populated the elements with the actual values.

Thanx a lot for your help!!!

Nice greetings from snowy austria,
Johannes


Am 18.12.2008 um 09:28 schrieb Carl Franks:

> 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;
>    }
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu




More information about the HTML-FormFu mailing list