[Catalyst] Catalyst with HTML::FormHandler
Hernan Lopes
hernanlopes at gmail.com
Fri Nov 5 20:09:33 GMT 2010
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 11/5/10, Blaine Everingham <grandmasterblaine at hotmail.com> wrote:
>
> Sorry the error message is
>
> Error: Can't locate MyApp/UserInterface/Form/User.pm in @INC (@INC contains:
> C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib
> C:/strawberry/perl/lib .)
> Resource: User.pm
> Path: /MyApp-Software/lib/MyApp/UserInterface/Controller/Admin
> Location: line 5
>
> Line 5 of /MyApp-Software/lib/MyApp/UserInterface/Controller/Admin/User.pm
> is:
> use MyApp::UserInterface::Form::User;
>
>
>
>> Date: Fri, 5 Nov 2010 14:40:37 -0400
>> From: steve at matsch.com
>> To: catalyst at lists.scsys.co.uk
>> Subject: Re: [Catalyst] Catalyst with HTML::FormHandler
>>
>> The actual error message would help...
>> On 11/5/2010 2:33 PM, Blaine Everingham wrote:
>> > I'm new to Catalyst and and trying to build a simple form.
>> >
>> > In the Catalyst controller
>> > MyApp/UserInterface/Controller/Admin/Users.pm I've added an 'use
>> > MyApp::UserInterface::Form::User', however it can not find this file.
>> > Meaning that it's not in the INC path.
>> >
>> > Obviously I could push this directory on to the INC stack, but none of
>> > the examples that I've seen have had to do this. What is the proper
>> > way to go about this?
>> >
>> > Below is an example of the directory structure.
>> >
>> > MyApp/UserInterface/Controller
>> > MyApp/UserInterface/Controller/Admin
>> > MyApp/UserInterface/Controller/Admin/Users.pm
>> > MyApp/UserInterface/Form
>> > MyApp/UserInterface/Form/User.pm
>> > MyApp/UserInterface/Model
>> > MyApp/UserInterface/Schema
>> > MyApp/UserInterface/View
>> >
>> >
>> > _______________________________________________
>> > 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/
>>
>> _______________________________________________
>> 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