[Catalyst] FormHandler -- pro or con?
Hernan Lopes
hernanlopes at gmail.com
Tue Dec 7 13:01:50 GMT 2010
Of course you can load a fields config from a file, db or wathever
here is a simple form example of formhandler with perl catalyst:
in your User.pm controller:
use HTML::FormHandler;
sub fields {
return [
display0 => {
type => 'Display',
html => '<h1>Personal data</h1>',
},
name => {
type => 'Text',
label => 'Name',
required => 0,
required_message => 'required',
css_class => 'form50',
},
submit => {
type => 'Submit',
css_class => 'form100 clear',
value => 'submit',
},
];
}
sub myform :Path('/myform') :Args(0) {
my ( $self, $c ) = @_;
my $form =
HTML::FormHandler->new(
field_list => $self->fields);
$c->res->body( $form->render );
}
On 12/7/10, Octavian Rasnita <orasnita at gmail.com> wrote:
> From: "Toby Corkindale" <toby at dryft.net>
>
>> On 1 December 2010 02:34, will trillich <will.trillich at serensoft.com>
>> wrote:
>>> Anybody else *dissing* FormHandler? We've started developing based on
>>> FormHandler lately and haven't had troubles... yet?
>>
>> I'm running it, and have been very happy with it.
>> It's nice that you can put all your common form elements into roles
>> and then combine them.
>> I'm familiar with Moose, so HFH's syntax came fairly naturally to me,
>> but I guess it could be confusing to others?
>>
>> Performance is reasonable - and a lot faster compared to FormFu.
>>
>> Cheers,
>> Toby
>
>
> Is there a way of making H::FH beeing more elegant?
>
> I mean, is there a way of doing something to not need using Perl code for
> creating the forms, but only using some configuration files like in H::FF's
> case?
>
> Thanks.
>
> Octavian
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
More information about the Catalyst
mailing list