NAME

HTML::FormFu::Library - Library of precompiled HTML::FormFu forms

VERSION

version 0.004

SYNOPSIS

    my $form1 = HTML::FormFu->new(...);
    my $form2 = HTML::FormFu->new(...);
    my $model = My::Schema->connect(...);
    my $query = { param => 'value', ... };

    my $library = HTML::FormFu::Library->new(
        cache => { form1 => $form1, form2 => $form2 },
        model => $model,
        query => $query,
    );

    if ( $library->form('form1')->submitted_and_valid ) { ... }

DESCRIPTION

HTML::FormFu::Library is a module for managing HTML::FormFu forms in a persistent environment, and is meant to be used in conjunction with Catalyst::Model::FormFu. It is constructed with a list of populated form objects, and returns clones of these objects via the form method.

METHODS

form

Given the id of one or more forms stored in the cache, clones the form objects, supplies query values, adds a model object to the form stash, processes the form and returns it.

raw_form

Same as form above, but does not process the forms before returning them. Useful to avoid calling process multiple times when you need to make further modification to the form object.

cached_form

Returns the original form, a clone of which you get when you use form or raw_form. Any changes you make to the state of a cached form will be reflected in all objects produced via subsequent calls to form and raw_form. Do not use unless you know what you are doing.

SEE ALSO

AUTHOR

Peter Shangov <pshangov@yahoo.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Peter Shangov.

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