NAME

Catalyst::Controller::HTML::FormHandler

SYNOPSIS

A base controller class for Catalyst controllers to use HTML::FormHandler forms.

DESCRIPTION

In a Catalyst controller:

package MyApp::Controller::Book;
use base 'Catalyst::Controller::Form::Processor';

__PACKAGE__->config( model_name => 'DB', form_name_space => 'MyApp::Form');

sub edit : Local {
   my ( $self, $c ) = @_;
   $c->forward('do_form');
}

sub form : Private {
   my ( $self, $c, $id ) = @_;

   $self->ctx->stash->{template} = 'book/form.tt';
   return unless $self->update_from_form( $id, 'Book' ); 
   $c->res->redirect($c->uri_for('list'));
}

(See Catalyst::Controller::Role::HTML::FormHandler for an example using chained.)

Or configure model_name and form_name_space for the entire app:

MyApp->config( { 'Controller::HTML::FormHandler' => 
       { model_name => 'DB', form_name_space => 'MyApp::Form' }} );

Config Options

model_name

Set the Catalyst model name. Currently only used by Form::Processor::Model::DBIC.

form_name_space

Set the name space to look for forms. Otherwise, forms will be found in a "Form" directory parallel to the controller directory. Override with "+" and complete package name.

fif

Set $c->stash->{fillinform} to the $form->fif parameter hash to make the 'end' routine call FillInForm.

METHODS

get_form

Determine the form package name, and "require" the form. Massage the parameters into the form expected by Form::Processor, including getting the schema from the model name and passing it into the DBIC model. Put the form object into the Catalyst stash.

validate_form

Validate the form

update_from_form

Use for forms that have a database interface

form_posted

convenience method checking for POST

DESCRIPTION

The "end" method will use FillInForm to render the form, unless the "fif" config value has been set to false.

If you have a custom "end" routine in your subclassed controllers and want to use FillInForm to fill in your forms, you can use this as a sample of how to handle FillInForm in your custom 'end'.

AUTHOR

Gerda Shank, modeled on Catalyst::Plugin::Form::Processor by Bill Moseley

COPYRIGHT

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 95:

You forgot a '=back' before '=head1'

Around line 200:

You forgot a '=back' before '=head1'

Around line 209:

=back without =over