[Catalyst] Recommend methods for form handling

Hartmaier Alexander Alexander.Hartmaier at t-systems.at
Wed Jan 17 19:11:25 GMT 2007


Hi Jim!

I don't recommend the use of FillInForm, I dropped it finally two weeks ago when I had time to refactor my Catalyst apps that used it.
Now I handle forms by putting the data they should show on the stash with $c->stash->{form_data}->{fieldname} = 'value';
I have to private actions to do this, one _from_db and one _from_params.
Their names should be self-explanatory.
E.g. the edit action forwards to the _from_db method on first load of the form which is detected by checking for method POST and the value of the submit button, else the _from_params.

With this I don't have to overwrite the cgi params and have full control of what my form should display.

Those values are used in my templates like value="[% form_data.fieldname %]".

You can look at FormBuilder which should be pretty good from what I've heard.
I'll wait for Reaction and invest some time in learning how to use it when it's done.

Ah, and I use Plugin::FormValidator for the form validation. A private do_form method does this and is used for both add and edit methods.

-Alex


> -----Original Message-----
> From: Jim Spath [mailto:jspath at pangeamedia.com]
> Sent: Wednesday, January 17, 2007 7:09 PM
> To: catalyst at lists.rawmode.org
> Subject: [Catalyst] Recommend methods for form handling
> 
> I was wondering what the current consensus among Catalyst users is about
> what the best way to approach forms is?
> 
> I started off writing the forms directly into the template, validating
> with FormValidator::Simple, and trying to fill values in with
> FillInForm.
> 
> I really liked FormValidator::Simple alot, and writing the forms
> directly in the template gives designers complete control, but I had
> some trouble with FillInForm and read that it could be slow, so I
> decided to try something else.
> 
> I'm trying out HTML::Widget now, since the Advanced CRUD tutorial uses
> it, and I guess it seems ok, although its validation capabilities don't
> seem as powerful as FormValidator::Simple.  Also, it seems like it makes
> it harder for designers to work with the forms, and I'm about its
> performance.
> 
> I guess I'm just looking for some opinions on which methodology to
> choose.  Performance is probably the biggest consideration for me, but
> validation, ease of development, and allowing for designers to easily
> edit the appearance are all important.
> 
> Thanks!
> Jim
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-
> archive.com/catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*




More information about the Catalyst mailing list