head 1.2; access; symbols pkgsrc-2023Q4:1.2.0.148 pkgsrc-2023Q4-base:1.2 pkgsrc-2023Q3:1.2.0.146 pkgsrc-2023Q3-base:1.2 pkgsrc-2023Q2:1.2.0.144 pkgsrc-2023Q2-base:1.2 pkgsrc-2023Q1:1.2.0.142 pkgsrc-2023Q1-base:1.2 pkgsrc-2022Q4:1.2.0.140 pkgsrc-2022Q4-base:1.2 pkgsrc-2022Q3:1.2.0.138 pkgsrc-2022Q3-base:1.2 pkgsrc-2022Q2:1.2.0.136 pkgsrc-2022Q2-base:1.2 pkgsrc-2022Q1:1.2.0.134 pkgsrc-2022Q1-base:1.2 pkgsrc-2021Q4:1.2.0.132 pkgsrc-2021Q4-base:1.2 pkgsrc-2021Q3:1.2.0.130 pkgsrc-2021Q3-base:1.2 pkgsrc-2021Q2:1.2.0.128 pkgsrc-2021Q2-base:1.2 pkgsrc-2021Q1:1.2.0.126 pkgsrc-2021Q1-base:1.2 pkgsrc-2020Q4:1.2.0.124 pkgsrc-2020Q4-base:1.2 pkgsrc-2020Q3:1.2.0.122 pkgsrc-2020Q3-base:1.2 pkgsrc-2020Q2:1.2.0.118 pkgsrc-2020Q2-base:1.2 pkgsrc-2020Q1:1.2.0.98 pkgsrc-2020Q1-base:1.2 pkgsrc-2019Q4:1.2.0.120 pkgsrc-2019Q4-base:1.2 pkgsrc-2019Q3:1.2.0.116 pkgsrc-2019Q3-base:1.2 pkgsrc-2019Q2:1.2.0.114 pkgsrc-2019Q2-base:1.2 pkgsrc-2019Q1:1.2.0.112 pkgsrc-2019Q1-base:1.2 pkgsrc-2018Q4:1.2.0.110 pkgsrc-2018Q4-base:1.2 pkgsrc-2018Q3:1.2.0.108 pkgsrc-2018Q3-base:1.2 pkgsrc-2018Q2:1.2.0.106 pkgsrc-2018Q2-base:1.2 pkgsrc-2018Q1:1.2.0.104 pkgsrc-2018Q1-base:1.2 pkgsrc-2017Q4:1.2.0.102 pkgsrc-2017Q4-base:1.2 pkgsrc-2017Q3:1.2.0.100 pkgsrc-2017Q3-base:1.2 pkgsrc-2017Q2:1.2.0.96 pkgsrc-2017Q2-base:1.2 pkgsrc-2017Q1:1.2.0.94 pkgsrc-2017Q1-base:1.2 pkgsrc-2016Q4:1.2.0.92 pkgsrc-2016Q4-base:1.2 pkgsrc-2016Q3:1.2.0.90 pkgsrc-2016Q3-base:1.2 pkgsrc-2016Q2:1.2.0.88 pkgsrc-2016Q2-base:1.2 pkgsrc-2016Q1:1.2.0.86 pkgsrc-2016Q1-base:1.2 pkgsrc-2015Q4:1.2.0.84 pkgsrc-2015Q4-base:1.2 pkgsrc-2015Q3:1.2.0.82 pkgsrc-2015Q3-base:1.2 pkgsrc-2015Q2:1.2.0.80 pkgsrc-2015Q2-base:1.2 pkgsrc-2015Q1:1.2.0.78 pkgsrc-2015Q1-base:1.2 pkgsrc-2014Q4:1.2.0.76 pkgsrc-2014Q4-base:1.2 pkgsrc-2014Q3:1.2.0.74 pkgsrc-2014Q3-base:1.2 pkgsrc-2014Q2:1.2.0.72 pkgsrc-2014Q2-base:1.2 pkgsrc-2014Q1:1.2.0.70 pkgsrc-2014Q1-base:1.2 pkgsrc-2013Q4:1.2.0.68 pkgsrc-2013Q4-base:1.2 pkgsrc-2013Q3:1.2.0.66 pkgsrc-2013Q3-base:1.2 pkgsrc-2013Q2:1.2.0.64 pkgsrc-2013Q2-base:1.2 pkgsrc-2013Q1:1.2.0.62 pkgsrc-2013Q1-base:1.2 pkgsrc-2012Q4:1.2.0.60 pkgsrc-2012Q4-base:1.2 pkgsrc-2012Q3:1.2.0.58 pkgsrc-2012Q3-base:1.2 pkgsrc-2012Q2:1.2.0.56 pkgsrc-2012Q2-base:1.2 pkgsrc-2012Q1:1.2.0.54 pkgsrc-2012Q1-base:1.2 pkgsrc-2011Q4:1.2.0.52 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q3:1.2.0.50 pkgsrc-2011Q3-base:1.2 pkgsrc-2011Q2:1.2.0.48 pkgsrc-2011Q2-base:1.2 pkgsrc-2011Q1:1.2.0.46 pkgsrc-2011Q1-base:1.2 pkgsrc-2010Q4:1.2.0.44 pkgsrc-2010Q4-base:1.2 pkgsrc-2010Q3:1.2.0.42 pkgsrc-2010Q3-base:1.2 pkgsrc-2010Q2:1.2.0.40 pkgsrc-2010Q2-base:1.2 pkgsrc-2010Q1:1.2.0.38 pkgsrc-2010Q1-base:1.2 pkgsrc-2009Q4:1.2.0.36 pkgsrc-2009Q4-base:1.2 pkgsrc-2009Q3:1.2.0.34 pkgsrc-2009Q3-base:1.2 pkgsrc-2009Q2:1.2.0.32 pkgsrc-2009Q2-base:1.2 pkgsrc-2009Q1:1.2.0.30 pkgsrc-2009Q1-base:1.2 pkgsrc-2008Q4:1.2.0.28 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.2.0.26 pkgsrc-2008Q3-base:1.2 cube-native-xorg:1.2.0.24 cube-native-xorg-base:1.2 pkgsrc-2008Q2:1.2.0.22 pkgsrc-2008Q2-base:1.2 cwrapper:1.2.0.20 pkgsrc-2008Q1:1.2.0.18 pkgsrc-2008Q1-base:1.2 pkgsrc-2007Q4:1.2.0.16 pkgsrc-2007Q4-base:1.2 pkgsrc-2007Q3:1.2.0.14 pkgsrc-2007Q3-base:1.2 pkgsrc-2007Q2:1.2.0.12 pkgsrc-2007Q2-base:1.2 pkgsrc-2007Q1:1.2.0.10 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.8 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.2.0.6 pkgsrc-2006Q3-base:1.2 pkgsrc-2006Q2:1.2.0.4 pkgsrc-2006Q2-base:1.2 pkgsrc-2006Q1:1.2.0.2 pkgsrc-2006Q1-base:1.2 pkgsrc-2005Q4:1.1.1.1.0.16 pkgsrc-2005Q4-base:1.1.1.1 pkgsrc-2005Q3:1.1.1.1.0.14 pkgsrc-2005Q3-base:1.1.1.1 pkgsrc-2005Q2:1.1.1.1.0.12 pkgsrc-2005Q2-base:1.1.1.1 pkgsrc-2005Q1:1.1.1.1.0.10 pkgsrc-2005Q1-base:1.1.1.1 pkgsrc-2004Q4:1.1.1.1.0.8 pkgsrc-2004Q4-base:1.1.1.1 pkgsrc-2004Q3:1.1.1.1.0.6 pkgsrc-2004Q3-base:1.1.1.1 pkgsrc-2004Q2:1.1.1.1.0.4 pkgsrc-2004Q2-base:1.1.1.1 pkgsrc-2004Q1:1.1.1.1.0.2 pkgsrc-2004Q1-base:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.2 date 2006.02.07.11.35.21; author abs; state Exp; branches; next 1.1; 1.1 date 2003.12.04.15.32.27; author grant; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2003.12.04.15.32.27; author grant; state Exp; branches; next ; desc @@ 1.2 log @Update www/p5-CGI-FormBuilder to 3.0202 COMPATIBILITY FormBuilder 3.0 should be completely compatible with FormBuilder 2.x, with the singular exception that you can no longer use the shortcut autoload style of getting to fields: $form->field(name => 'category', options => \@@opt); $form->category(options => \@@opt); # WRONG In order to allow the second form, you must specify the "fieldsubs" option to "new()". VERSION 3.0202 This is a bugfix release that patches the following problems: - missing $form->name accessor - $form->confirm displaying wrong value for radio groups - $form->new(messages => $file) not reading file (tries to bless directly) - added $form->field(delete => 1) option - disabling field comment on static fields - fixing $form->field(disabled => 0) - redone messages joiner on array passing (internals thing) The changed files are: CGI/FormBuilder.pm CGI/FormBuilder/Field.pm CGI/FormBuilder/Messages.pm All other sub-modules shipped are identical to the 3.02 versions; those modules retain the same version and signature. VERSION 3.02 Multi-Page Form Support A new module, "CGI::FormBuilder::Multi", has been added to handle the navigation and state of multi-page forms. A multi-page form is actually composed of several individual forms, tied together with the special CGI param "_page": my $multi = CGI::FormBuilder::Multi->new( # first args are hashrefs per-form \%form1_opts, \%form2_opts, \%form3_opts, # remaining options apply to all forms header => 1, method => 'POST', ); my $form = $multi->form; # current form if ($form->submitted && $form->validate) { # you write this do_data_update($form->fields); # last page? if ($multi->page == $multi->pages) { print $form->confirm; exit; } $multi->page++; # next page counter $form = $multi->form; # fetch next page's form } print $form->render; For more details, see CGI::FormBuilder::Multi. External Source File Inspired by Peter Eichman's "Text::FormBuilder", the new "source" option has been added to "new()" which enables the use of an external config file to initialize FormBuilder. This file takes the format: # sample config file method: POST header: 1 submit: Update, Delete fields: fname: label: First Name size: 50 validate: NAME lname: label: Last Name size: 40 validate: NAME sex: label: Gender options: M=Male, F=Female jsclick: javascript:alert("Change your mind??"); validate: M,F required: ALL messages: form_invalid_text: Please correct the following fields: form_required_text: Please fill in all bold fields. You can even pre-parse this file, and generate a module from it which you can then reuse in multiple scripts using the "write_module()" function. For more details, see CGI::FormBuilder::Source::File. "Other" Fields The new "other" option has been added to "field()". If specified, a text box will be added to the right of the field, and its value will be used if the main field is not filled in. It will be subject to the same required and validation checks as the main field: $form->field(name => 'favorite_color', options => [qw(Red Green Blue)], validate => 'NAME', other => 1); # allow "other" This would create HTML something like this: Favorite Color: []Red []Green []Blue []Other: [____________] The text "Other:" is controlled by the message "form_other_default". Growable Fields Thanks to a patch from Peter Eichman, "field()" now also accepts a "growable" option. This option enables some JavaScript hooks that add an "Additional [label]" button on text and file fields: Data File: [______________] [Additional Data File] When you click on the "Additional Data File" button, another box will be appended, allowing you to add more files. The values are then retrieved in the usual fashion: my @@files = $form->field('data_file'); Like "other" fields, all elements are subject to validation checks. The text "Additional %s" is controlled by the message "form_grow_default". Support for "CGI::FastTemplate" Thanks once again to Peter Eichman (busy guy), the module "CGI::FormBuilder::Template::Fast" has been included. This adds the template type "Fast" as an interface to "CGI::FastTemplate": my $form = CGI::FormBuilder->new( template => { type => 'Fast', define => { form => 'form.tmpl', field => 'field.tmpl', } } See CGI::FormBuilder::Template::Fast for more details. Thanks again Peter! Subclassable Templates and tmpl_param() The 2.x "tmpl_param()" method has been reimplemented finally. In addition, the included template modules are now completely subclassable, meaning that you can create an entire template engine with something like this: package My::HTML::Template; use CGI::FormBuilder::Template::HTML; use base 'CGI::FormBuilder::Template::HTML'; # new() is inherited sub render { my $self = shift; my $form = shift; # complete form object # do any special actions here $self->SUPER::render; } For more details, see CGI::FormBuilder::Template. Message Changes All messages were reworded to make them shorter and easier to read. The phrase "You must" was removed from all of them. To see the new messages, cut-and-paste this code: perl -MCGI::FormBuilder::Messages \ -e 'CGI::FormBuilder::Messages->messages' In addition, the "form_submit_default" and "form_reset_default" messages were not even being used, and field labels were not being properly highlighted on error. These problems have been fixed. Autoloaded Fields The 2.x feature of "$form->$fieldname()" has been reimplemented, but using it requires the "fieldsubs" option: my $form = CGI::FormBuilder->new(fields => \@@f, fieldsubs => 1); Read the docs for some caveats. Disabled Form Similar to a static form, you can set "disabled => 1" in "new()" or "render()" to display a form with grayed-out input boxes. You can also set this on a per-field basis using "field()". Verbatim HTML Options If you want to include HTML in your field options, set "cleanopts" to 0 in "field()" (for one field) or "new()" (for all fields). Compatibility Methods For compatibility with other modules, FormBuilder now includes "param()", "query_string()", "self_url()", and "script_name()". VERSION 3.01 This was a bugfix release, including the following changes: - fixed major problems with keepextras, including a reversed ismember test - added debug messages to keepextras and changed a few other debugs - added patch from Peter Eichman to fix scalar $field->tag and $field->tag_value - converted most all XHTML generation methods to only returning scalars - fixed the columns option which was totally broken for radio buttons - added a feature to plop in {border => 0} in columns as well - added the 2.x 'override' alias for field() 'force' which was missing - also added a 'defaults' alias for field() 'value' for CGI.pm happiness - more tests since there were way too many bugs In addition there were many documentation updates and changes. VERSION 3.00 Internals The internals have been completely rewritten, nearly from the ground up. All of the major functions have been split into methods, and objects have been created for the form, fields, messages, CGI params, and so on. Several new sub-modules have been created, including: CGI::FormBuilder::Field CGI::FormBuilder::Messages CGI::FormBuilder::Template CGI::FormBuilder::Template::HTML CGI::FormBuilder::Template::Text CGI::FormBuilder::Template::TT2 Many of these modules can be subclassed and overridden if desired. In addition, the template engine has been rewritten to allow "plugging in" of additional template modules, simply by specifying the name of the module to the 'template' option in new(). For more details, see the man pages for the individual modules above. Style Sheets Stylesheets are now generated if the "stylesheet" option is specified to FormBuilder. This can either be 1 to turn it on, or a full path to a style sheet to include. When used, all tags are then output with a "class" attribute, named "styleclass" plus the name of the tag: my $form = CGI::FormBuilder->new( fields => [qw/name email/], styleclass => 'myFB', # default is "fb_" stylesheet => 1, # turn on style ); print $form->render; # HTML will include # # Compliant XHTML The output should be fully-compliant XHTML finally. Really. Maybe. Attributes and Field Objects Individual accessors have been added for every attribute that FormBuilder maintains. For example, here's a snippet of code to demonstrate: if ($form->stylesheet) { # loop thru fields, changing class for ($form->fields) { next if /_date$/; # skip fields named "XXX_date" # each field is a stringifiable object with accessors if ($_->options) { # has options $_->class('my_opt_style'); } else { # plain text box $_->class('my_text_style'); } } } This code checks to see if the "stylesheet" property has been set on the main $form. If so, then it loops thru all the fields, skipping those named "XXX_date". Of the remaining fields, those that have options have their "class" attribute changed to "my_opt_style", and those without options have it set to "my_text_style". In addition, you can individually render every part of the form yourself. by calling the appropriate method. For example: print $form->header; # just the header print $form->script; # opening JavaScript print $form->title; # form title print $form->start; # opening
tag for ($form->fields) { print $_->label; # each field's human label print $_->tag; # each field's tag } print $form->end; # closing
tag For a complete list of accessors, see the documentation for both CGI::FormBuilder and CGI::FormBuilder::Field. Messages Many messages have been reworded, and several new messages were added to make it easier to customize individual text. In addition, you can now specify messages to individual fields: $form->field(name => 'email', message => 'Please enter a valid email address'); For more details, see "CGI::FormBuilder::Messages". HTML::Entities encoding HTML character encoding is now dispatched to "HTML::Entities", if available. This can be downloaded as part of the "HTML::Parser" module set on CPAN. Documentation Documentation has been updated and somewhat reorganized, which was long overdue. AUTHOR Copyright (c) 2000-2005 Nathan Wiger, Sun Microsystems . All Rights Reserved. This module is free software; you may copy this under the terms of the GNU General Public License, or the Artistic License, copies of which should have accompanied your Perl kit. @ text @The goal of CGI::FormBuilder is to provide an easy way to generate and process CGI form-based applications. It is designed to be smart in that it figures a lot of stuff out for you. As a result, FormBuilder gives about a 4:1 ratio of the code it generates versus what you have to write. For example, if you have multiple values for a field, it sticks them in a radio, checkbox, or select group, depending on some factors. It will also automatically name fields for you in human-readable labels depending on the field names, and lay everything out in a nicely formatted table. It will even title the form based on the name of the script itself (order_form.cgi becomes "Order Form"). Plus, FormBuilder provides you full-blown validation for your fields, including some useful builtin patterns. It will even generate JavaScript validation routines on the fly! And, of course, it maintains state ("stickiness") across submissions, with hooks provided for you to plugin your own sessionid module such as Apache::Session. And though it's smart, it allows you to customize it as well. For example, if you really want something to be a checkbox, you can make it a checkbox. And, if you really want something to be output a specific way, you can even specify the name of an HTML::Template or Template Toolkit (Template) compatible template which will be automatically filled in, statefully. @ 1.1 log @Initial revision @ text @d1 4 a4 5 The goal of CGI::FormBuilder (FormBuilder) is to provide an easy way for you to generate and process CGI form-based applications. This module is designed to be smart in that it figures a lot of stuff out for you. As a result, FormBuilder gives you about a 4:1 ratio of the code it generates versus what you have to write. @ 1.1.1.1 log @Initial import of CGI-FormBuilder-2.12 into the NetBSD packages collection. The goal of CGI::FormBuilder (FormBuilder) is to provide an easy way for you to generate and process CGI form-based applications. This module is designed to be smart in that it figures a lot of stuff out for you. As a result, FormBuilder gives you about a 4:1 ratio of the code it generates versus what you have to write. For example, if you have multiple values for a field, it sticks them in a radio, checkbox, or select group, depending on some factors. It will also automatically name fields for you in human-readable labels depending on the field names, and lay everything out in a nicely formatted table. It will even title the form based on the name of the script itself (order_form.cgi becomes "Order Form"). Plus, FormBuilder provides you full-blown validation for your fields, including some useful builtin patterns. It will even generate JavaScript validation routines on the fly! And, of course, it maintains state ("stickiness") across submissions, with hooks provided for you to plugin your own sessionid module such as Apache::Session. And though it's smart, it allows you to customize it as well. For example, if you really want something to be a checkbox, you can make it a checkbox. And, if you really want something to be output a specific way, you can even specify the name of an HTML::Template or Template Toolkit (Template) compatible template which will be automatically filled in, statefully. @ text @@