[Catalyst] Suggestions on how to handle 12 page form

Rippl, Steve rippls at woodlandschools.org
Wed Nov 17 15:48:54 GMT 2010


On Tue, Nov 16, 2010 at 10:38 PM, Octavian Rasnita
<octavian.rasnita at ssifbroker.ro> wrote:
>
>
> Hi Bill,
>
> I think the best approach is to create an action for each "page" of the form and after each form submission partially update one or more database tables, saving a marker that shows which was the last page completed.
>
> And after each form submission, depending on some options chosen by the user you can redirect to the next form or to display a certain form which is displayed only in some conditions.
>
> After the user submitted the first form, in which you may ask him/her for his/her email, you can automaticly send him/her an email with a link that can be used to access this "wizard" where he/her left it, maybe even from another computer.
> This way, it is not a problem if the user's computer has frozen after he/she completed 99% of the wizard or he/she should continue only after a certain period.
>
> You can also put "previous links in every page that would display the previous filled form, pre-filled with the values this user already filled (which are taken from the database).
>
> For creating the forms you can use a tool like HTML::FormFu or manually-created forms... it doesn't matter.
>
> Octavian
>

I use the same controller for the whole form but point to a different
html::formfu .yml file for each page of the form.  I then put tabs
across the top of the form for each "page" so the user can go back and
forth, each submission saving that part of the form, the tabs linking
back to the same page with a different additional arg ($form_id) that
links to the corrent .yml file.  Something along the lines of...

sub index : Path {
    my ( $self, $c, $id, $form_id, $hash ) = @_;

   [-- validation etc --]

    $form = $self->form;
    $form->load_config_filestem($c->config->{root}."/forms/students/info$form_id");
    $form->process;
    $c->stash->{form} = $form;

    if ( $form->submitted_and_valid ) {
        [-- save stuff --]
    }

    [-- display stuff --]
}

The $hash variable is so I can email them a unique link back to the
form so they can complete it later (for folks not authenticated into
the system, ie. the public).


--
Steve Rippl
Technology Director
Woodland Public Schools
360 841 2730



More information about the Catalyst mailing list