|
::Features
::Download
::Tutorial
::Examples
::Documentation ::FormBuilder Google Group ::Old List Archives ::Contribute |
|
Intermediate Tutorial - Step 10: Smartness As we've seen repeatedly, FormBuilder does a lot of stuff for you automatically. In the majority of cases, this is good, but there may be occassion where you want FormBuilder to be a little "stupider" and just generate and process basic HTML and JavaScript.
This is easy to do, simply tweak the
$form = CGI::FormBuilder->new(
fields => \@fields,
smartness => 0 # dare to be stupid
);
Conversely, there's a whole bunch of stuff that FormBuilder can do but doesn't
by default. For example, FormBuilder can automatically guess at the type of field
something should be, just based on its name. For example, a field including the
regex passw[or]*d would become type password, a field including
the term "comments" could become type textarea, and so on.
If you want stuff like this, including automatic field validation and options, turn up the smartness:
$form = CGI::FormBuilder->new(
fields => \@fields,
smartness => 2 # genius level IQ
);
To see how much stuff this does for you, take a look at this smart version of the form method script that we saw way
back in the Basic Tutorial. Make sure to check out the HTML source for comparison. (The original script is
here)
|
| FormBuilder is © Nate Wiger, with contributions from many people. |