3 Feb 20:14
[FormBuilder] Multipage forms in Catalyst
From: José Parrella <joseparrella <at> gmail.com>
Subject: [FormBuilder] Multipage forms in Catalyst
Newsgroups: gmane.comp.lang.perl.modules.formbuilder
Date: 2007-02-03 19:16:40 GMT
Subject: [FormBuilder] Multipage forms in Catalyst
Newsgroups: gmane.comp.lang.perl.modules.formbuilder
Date: 2007-02-03 19:16:40 GMT
Greetings,
I've been trying to setup a few sites which need to implement multipage
forms, under Catalyst. I've read the tutorial in formbuilder.org
regarding multipage forms, and I've tried two different ways for this:
1) Setting up the first page is easy with C::Plugin::FB, and the
YAML-based source files. Therefore I use a single Local Form method in
Catalyst, and the form posts to itself. My whole method is a:
if ($c->form->submitted && $c->form->validate) {
... actions
}
Since I'm taking profit of the fact that using TT2, the template name is
setup by default to /root/≤path>.tt2. When the user is entering the
first page, $c->form isn't submitted nor validated, and it opens the
default template, which has a single form.render and "calls" the .fb
file to get the form configuration. Nice.
Of course, when a user enters some information and submits the form, I
get into my if statement (the form is submitted and validates), and I
can do all my DB stuff, etc. But if I want a second form to show up, I
can't set a particular .fb source file (so I can't set my second form
configuration), and the $c->form object is already filled with previous
information.
Using state parameters (such as "add", "show", etc.), doesn't help me
since I still can't call a particular source file.
2) If I set the submit action to another path, then $c->form moves
there, too. It also happens if I do something like
$c->forward(/another/path). Then I get strange behaviors such as fields
of the first form appearing in the second form, or fields getting the
values from the last form (maybe sticky = 0 will help?)
I truly think this (number 2) is the right way to work, but maybe I'm
missing something. I would really like to know what are you using and
which are your recommended best practices regarding multipage forms with
CGI::FB in Catalyst. I've already reduced hundreds of SLOCs based in CGI
and DBI to only tenths of clean code in Catalyst, but this has become a
show stopper, at least for me.
Thanks for your time and comments,
Jose
--
--
José M. Parrella -> Debian Sid, k2.6.18
Escuela de Ingenieria Electrica
Universidad Central de Venezuela -> ucvlug.info
_______________________________________________
FBusers mailing list
FBusers <at> formbuilder.org
http://www.formbuilder.org/mailman/listinfo/fbusers
RSS Feed