[html-formfu] wrong err msg because of detach to another form

Ashley Pond V ashley.pond.v at gmail.com
Tue Dec 1 21:05:29 GMT 2009


Untested but you can probably fix that by using ->go instead of
->detach (If you've got a recent enough version of Catalyst).

On Tue, Dec 1, 2009 at 12:52 PM, David Schmidt <davewood at gmx.at> wrote:
> Hello
>
> In my Cat App I show two forms to the User. The problem now is that
> when I submitted a valid form #1 my app detaches to form #2 where
> error messages are displayed according to the parameters of form #1
> which are still in the request.
>
> I've been looking in the CPAN docs but couldnt find anything related to that.
>
> sub show :Path('show') :Args(1) {
>    my ( $self, $c, $form_config) = @_;
>
>    # set the form
>    my $form = $self->form;
>    $form->load_config_file($form_config);
>    $form->process;
>
>    if ($form->submitted_and_valid &&
> (!(defined($c->stash->{dont_process_form})))) {
>        # make sure the same form isn't processed twice
>        # by using the dont_process_form var
>
>        ##########################
>        # do stuff with form data
>        # and manipulate session
>        ##########################
>
>        # otherwise deep recursion
>        $c->stash->{dont_process_form} = 1;
>        $c->detach($c->controller('Root')->action_for('index'));
>    } else {
>        $c->stash->{form} = $form;
>    }
> }
>
> In Root::index I dispatch to the required forms according to a
> session variable that indicates the state of the user.
>
> david
>
> _______________________________________________
> 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