Maypole::FormBuilder - CGI::FormBuilder support in Maypole
use Maypole::Application qw( FormBuilder QuickTable ); BeerFB->config->model( 'Maypole::FormBuilder::Model' );
Maypole provides a great framework for simplifying the interaction between a UI and a database. But it provides very little support for simplifying the interface itself. Programmers are left to construct each form, widget by widget, using modules that don't support important form use cases, such as what to do when a form submits nothing for an empty field.
CGI::FormBuilder already supports this and many, many other forms use cases. And it provides validation methods, multiform support, and automatically generated Javascript validation code. And plenty more.
This distribution uses Class::DBI::FormBuilder to generate the metadata required to automatically build FormBuilder forms from CDBI classes and objects.
The distribution includes:
Introductory documentation only.
as_form, search_form and as_forms methods for the Maypole request object.
as_form
search_form
as_forms
Maypole::Plugin::FormBuilder.
A model class based on Class::DBI. Note that this model does not inherit from Maypole::Model::CDBI.
Maypole::FormBuilder::Model.
Model methods that do not depend on the CDBI backend. Models based on a different persistence layer may wish to inherit from this class.
Maypole::FormBuilder::Model::Base.
A new set of templates for the Beer database. These are considerably simpler than the BeerDB templates.
templates-mason Mason templates templates-tt TT templates, donated by Ron McClain
Note that the templates also need Maypole::Plugin::QuickTable.
Also note, TT users must bless an object called mclass into $request->model_class and add it to the template vars in additional_data(). This is to make moniker work, which will always return Proxy if if you do [% mclass = Class(request.model_class) %] because Class creates a Proxy object around the model class.
mclass
$request->model_class
additional_data()
moniker
Proxy
[% mclass = Class(request.model_class) %]
Class
If you build a form, and it has no 'name' or 'id' defined, you have probably called as_form on a CDBI class or object, rather than on the Maypole request object. I often do this when building a form for a different object or class from that represented in the request. Use the 'entity' argument to Maypole::Plugin::FormBuilder::as_form() to do this.
David Baird, <cpan@riverside-cms.co.uk>
<cpan@riverside-cms.co.uk>
Edit and update actions from the editable list template are broken.
After creating or editing an object, if the return is to a list template, need to ensure the appropriate page is set. Or just go back to the original workflow and display the view template instead.
view
The development version of Class::DBI::Plugin::Pager (which is the version I have installed) has a bug, so I haven't been able to test using it via the <BeerFB-config->pager_class>> setting.
<BeerFB-
Please report any bugs or feature requests to bug-maypole-formbuilder@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Maypole-FormBuilder. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-maypole-formbuilder@rt.cpan.org
Most links from the editlist template return the user to the list template, rather than staying in the editlist view.
editlist
list
Copyright 2005 David Baird, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Maypole::FormBuilder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Maypole::FormBuilder
CPAN shell
perl -MCPAN -e shell install Maypole::FormBuilder
For more information on module installation, please visit the detailed CPAN module installation guide.