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

David Schmidt davewood at gmx.at
Wed Dec 2 08:18:57 GMT 2009


On Tue, Dec 1, 2009 at 10:05 PM, Ashley Pond V <ashley.pond.v at gmail.com> wrote:
> 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.
>>

"go" doesnt make a difference on Cat 5.80013



More information about the HTML-FormFu mailing list