Perl Form Builder ::Features ::Download ::Tutorial ::Examples
::Documentation ::FormBuilder Google Group ::Old List Archives ::Contribute
Note: The mailing list is has been replaced by the Google FormBuilder Group


1. Intro to FormBuilder
2. A Simple Form
3. Form Method
4. Input Validation
5. Field Options
6. Multi-Select Lists
7. Field Data
8. Field Attributes
9. HTML Formatting
10. Custom Headers
S. Summary


1. Trickier Forms
2. Perl References
3. Default Values
4. CGI Stickiness
5. JavaScript Actions
6. Input Validation 2
7. Multiple Submits
8. JavaScript Actions 2
9. Modules & mod_perl
10. Smartness
S. Summary


1. Remaining Features
2. Intro to Templates
3. HTML::Template
4. HTML::Template 2
5. Template Toolkit
6. Exploiting render()
7. Multi-Screen Apps
8. Multi-Screen Apps 2
9. Multi-Screen Apps 3
10. Custom Messages
S. Summary

Basic Tutorial - Step 9: HTML Formatting Print

<< Field Attributes | Custom Headers >>

You'll notice that the forms output thus far are very simple. White background, black font, generic text. This might've worked back in 1995, but it's a little boring these days.

FormBuilder provides you plenty of flexibility to make your forms as fancy as you want. In fact, there is a whole host of options you can use to change every part of the HTML formatting:

$form = CGI::FormBuilder->new(
             fields => \@fields,
             required => 'ALL',     # all fields must be filled in
             font   => 'arial,helvetica',
             title  => 'Personal Information',
             text   => 'Please input your personal info below:',
             lalign => 'right',     # align field labels to right
             table  => {            # change the <table>
                bgcolor => 'gray', 
                border  => 0,
                cellspacing => 0,
                cellpadding => 5,
             body   => {            # change the <body>
                bgcolor => '#3399CC',
                text    => 'white',
                link    => '#CC0000', 
                vlink   => '#CC0000', 
                alink   => '#CC0000', 
These are listed in order of decreasing usefulness. That is, in real life you will probably find yourself wanting to generate your own HTML header and footer, negating the need to change the body or even the title. However, the font option is quite useful, because FormBuilder will automatically generate font tags for every single table element. (Even better, check out the stylesheet option)

To get a taste of this formatting, see this in action, and check out the HTML generated.

<< Field Attributes | Custom Headers >>

FormBuilder is © Nate Wiger, with contributions from many people.