~ubuntu-branches/ubuntu/precise/libcgi-formbuilder-perl/precise

« back to all changes in this revision

Viewing changes to lib/CGI/FormBuilder.pod

  • Committer: Package Import Robot
  • Author(s): Jonas Smedegaard
  • Date: 2011-09-11 02:55:17 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110911025517-nhr6j6fwwc9xc4l1
Tags: 3.06-1
* New upstream release.
* Use CDBS perl-makemaker.mk (not deprecated perlmodule.mk).
  Tighten build-dependency on CDBS.
* Update copyright file:
  + Fix use Comment field (not License-Comments).
  + Quote license names in comments.
* Add patch cherry-picked upstream to fix testsuite.
* Update package relations:
  + Build-depend on and suggest libcgi-ssi-perl.
  + Make suggestions unversioned and drop conflicts: satisfied even in
    oldstable.
  + Maintain all relations using CDBS in rules file.
* Stop preserving cruft no long shipped upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
=head1 DESCRIPTION
59
59
 
60
60
If this is your first time using B<FormBuilder>, you should check out
61
 
the website for tutorials and examples:
62
 
 
63
 
    www.formbuilder.org
64
 
 
65
 
You should also consider joining the mailing list by sending an email to:
66
 
 
67
 
    fbusers-subscribe@formbuilder.org
68
 
 
 
61
the website for tutorials and examples at L<http://formbuilder.org>.
 
62
 
 
63
You should also consider joining the google group at 
 
64
L<http://groups.google.com/group/perl-formbuilder>.
69
65
There are some pretty smart people on the list that can help you out.
70
66
 
71
67
=head2 Overview
1082
1078
it required. However, you can use the C<required> option to change
1083
1079
this, see it for more details.
1084
1080
 
1085
 
Let's look at a concrete example:
 
1081
Let's look at a concrete example.  Note that the javascript
 
1082
validation is a negative match, while the perl validation
 
1083
is a positive match.
1086
1084
 
1087
1085
    my $form = CGI::FormBuilder->new(
1088
 
                    fields => [
1089
 
                        qw(username password confirm_password
1090
 
                           first_name last_name email)
1091
 
                    ],
1092
 
                    validate => {
1093
 
                        username   => [qw(nate jim bob)],
1094
 
                        first_name => '/^\w+$/',    # note the 
1095
 
                        last_name  => '/^\w+$/',    # single quotes!
1096
 
                        email      => 'EMAIL',
1097
 
                        password   => \&check_password,
1098
 
                        confirm_password => {
1099
 
                            javascript => '== form.password.value',
1100
 
                            perl       => 'eq $form->field("password")'
1101
 
                        },
1102
 
                    },
1103
 
               );
 
1086
        fields => [qw(
 
1087
            username    password    confirm_password
 
1088
            first_name  last_name   email
 
1089
        )],
 
1090
        validate => {
 
1091
            username   => [qw(nate jim bob)],
 
1092
            first_name => '/^\w+$/',    # note the 
 
1093
            last_name  => '/^\w+$/',    # single quotes!
 
1094
            email      => 'EMAIL',
 
1095
            password   => \&check_password,
 
1096
            confirm_password => {
 
1097
                javascript => '!= form.password.value',       # neg
 
1098
                perl       => 'eq $form->field("password")',  # pos
 
1099
            },
 
1100
        },
 
1101
    );
1104
1102
 
1105
1103
    # simple sub example to check the password
1106
1104
    sub check_password ($) {
1282
1280
 
1283
1281
    $form->field(name => 'email', size => '40');
1284
1282
 
 
1283
=item add_after_option => $html
 
1284
 
 
1285
Adds the specified HTML code after each checkbox (or radio) option.
 
1286
 
 
1287
=item add_before_option => $html
 
1288
 
 
1289
Adds the specified HTML code before each checkbox (or radio) option.
 
1290
 
1285
1291
=item columns => 0 | $width
1286
1292
 
1287
1293
If set and the field is of type 'checkbox' or 'radio', then the
2696
2702
    Klaas Naajikens
2697
2703
    Koos Pol
2698
2704
    Shawn Poulson
 
2705
    Victor Porton
2699
2706
    Dan Collis Puro
 
2707
    Wolfgang Radke
2700
2708
    David Siegal
2701
2709
    Stephan Springl
2702
2710
    Ryan Tate
2722
2730
 
2723
2731
=head1 AUTHOR
2724
2732
 
2725
 
Copyright (c) 2000-2006 Nate Wiger <nate@wiger.org>. All Rights Reserved.
 
2733
Copyright (c) L<Nate Wiger|http://nateware.com>. All Rights Reserved.
2726
2734
 
2727
2735
This module is free software; you may copy this under the terms of
2728
2736
the GNU General Public License, or the Artistic License, copies of