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

Basic

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

Intermediate

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

Advanced

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

Advanced Tutorial - Step 6: Exploiting render() Print

<< Template Toolkit | Multi-Screen Apps >>

So far, we have only seen one option to render(), the header argument used to turn headers on or off. However, render() is much more powerful and accepts many more options.

In fact, render() will accept the exact same options as new(). This means that you can specify some options to new(), and others to render(), depending on what you're trying to do.

Here's a brief example of how this might come in handy:

#!/usr/bin/perl

use CGI::FormBuilder;

$form = CGI::FormBuilder->new(
             method => 'post',
             fields => [qw/name email mlist/],
        );

$form->field(name => 'mlist', options => [qw/Yes No/],
             value => 'Yes');

if ($form->submitted) {
    # you would write code here to act on the form data
    print $form->confirm(template => 'email_success.tmpl');
} else {
    print $form->render(template => 'email_form.tmpl')
}
In fact, there are other important uses of this flexibility with multi-screen applications, as we'll see next.

<< Template Toolkit | Multi-Screen Apps >>

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