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.
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_forms methods for the Maypole request object.
Model methods that do not depend on the CDBI backend. Models based on a different persistence layer may wish to inherit from this class.
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
$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.
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.
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.
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
Please report any bugs or feature requests to
firstname.lastname@example.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.
Most links from the
editlist template return the user to the
list template, rather than staying in the
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.