NAME

HTML::EasyForm - A wrapper for HTML::FormHandler, trying to be a different default handling

VERSION

version 0.001

SYNOPSIS

In your Template::Toolkit configuration:

use HTML::EasyForm;

...
INCLUDE_PATH => [
  MyApp->path_to('templates'),
  HTML::EasyForm->template_dir,
],
...

Your formclass:

package MyApp::Form::Mini;

use HTML::FormHandler::Moose;
extends 'HTML::EasyForm';

has_field 'name' => ( type => 'Text', required => 1 );

1;

In your favorite web framework:

my $form = MyApp::Form::Mini->easy({
  action => $c->uri_for($c->action,$c->req->captures),
  params => $c->req->parameters,
});

if ($form->validated) {
  ... do stuff with $form->value ...
}

my $other_form = HTML::EasyForm->easy({
  name => 'my_custom_form',
  fid => $some_id_per_usage,
  action => $c->uri_for($c->action,$c->req->captures),
  params => $c->req->parameters,
  item => \%values,
  field_list => [
    field_one => {
      type => 'Text',
      required => 1
    },
    field_two => 'Text',
  ],
});

In your template (suggesting the form is assigned as form):

<@ PROCESS form.tt @>

or:

<@ PROCESS form.tt form=other_form @>  

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.