File Coverage

blib/lib/Maypole/FormBuilder.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Maypole::FormBuilder;
2              
3 1     1   21374 use warnings;
  1         2  
  1         27  
4 1     1   4 use strict;
  1         1  
  1         66  
5              
6             our $VERSION = 0.44;
7              
8             # $Rev: 792 $
9             # $Date: 2005-09-26 11:11:52 +0100 (Mon, 26 Sep 2005) $
10              
11             =head1 NAME
12              
13             Maypole::FormBuilder - CGI::FormBuilder support in Maypole
14              
15             =head1 SYNOPSIS
16              
17             use Maypole::Application qw( FormBuilder QuickTable );
18            
19             BeerFB->config->model( 'Maypole::FormBuilder::Model' );
20              
21             =head1 DESCRIPTION
22              
23             L provides a great framework for simplifying the interaction between
24             a UI and a database. But it provides very little support for simplifying the interface
25             itself. Programmers are left to construct each form, widget by widget, using modules that
26             don't support important form use cases, such as what to do when a form submits nothing
27             for an empty field.
28              
29             L already supports this and many, many other forms
30             use cases. And it provides validation methods, multiform support, and automatically
31             generated Javascript validation code. And plenty more.
32              
33             This distribution uses L to generate the
34             metadata required to automatically build FormBuilder forms from CDBI classes and objects.
35              
36             The distribution includes:
37              
38             =over 4
39              
40             =item Maypole::FormBuilder
41              
42             Introductory documentation only.
43              
44             =item Maypole::Plugin::FormBuilder
45              
46             C, C and C methods for the Maypole request
47             object.
48              
49             L.
50              
51             =item Maypole::FormBuilder::Model
52              
53             A model class based on L. Note that this model does B
54             inherit from L.
55              
56             L.
57              
58             =item Maypole::FormBuilder::Model::Base
59              
60             Model methods that do not depend on the CDBI backend. Models based on a different
61             persistence layer may wish to inherit from this class.
62              
63             L.
64              
65             =item templates
66              
67             A new set of templates for the Beer database. These are considerably simpler than the
68             BeerDB templates.
69              
70             templates-mason Mason templates
71             templates-tt TT templates, donated by Ron McClain
72              
73             Note that the templates also need L.
74              
75             Also note, TT users must bless an object called C into
76             C<< $request->model_class >> and add it to the template vars in C.
77             This is to make C work, which will always return C if if you
78             do C<[% mclass = Class(request.model_class) %]> because C creates a
79             Proxy object around the model class.
80            
81             =back
82              
83             =head2 Random notes
84              
85             If you build a form, and it has no 'name' or 'id' defined, you have probably called C on a CDBI
86             class or object, rather than on the Maypole request object. I often do this when building a form
87             for a different object or class from that represented in the request. Use the 'entity' argument to
88             Maypole::Plugin::FormBuilder::as_form() to do this.
89              
90             =head1 AUTHOR
91              
92             David Baird, C<< >>
93              
94             =head1 BUGS
95              
96             Edit and update actions from the editable list template are broken.
97              
98             After creating or editing an object, if the return is to a list template, need to ensure the
99             appropriate page is set. Or just go back to the original workflow and
100             display the C template instead.
101              
102             The development version of L (which is
103             the version I have installed) has a bug, so I haven't been able to test using it via the
104             C<config->pager_class>> setting.
105              
106             Please report any bugs or feature requests to
107             C, or through the web interface at
108             L.
109             I will be notified, and then you'll automatically be notified of progress on
110             your bug as I make changes.
111              
112             =head1 TODO
113              
114             Most links from the C template return the user to the C template,
115             rather than staying in the C view.
116              
117             =head1 COPYRIGHT & LICENSE
118              
119             Copyright 2005 David Baird, All Rights Reserved.
120              
121             This program is free software; you can redistribute it and/or modify it
122             under the same terms as Perl itself.
123              
124             =cut
125              
126             1; # End of Maypole::FormBuilder