CGI::FormBuilder

CGI::FormBuilder is a Perl module to easily generate and process stateful forms.
Download

CGI::FormBuilder Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Nate Wiger
  • Publisher web site:
  • http://search.cpan.org/~nwiger/

CGI::FormBuilder Tags


CGI::FormBuilder Description

CGI::FormBuilder is a Perl module to easily generate and process stateful forms. CGI::FormBuilder is a Perl module to easily generate and process stateful forms.SYNOPSIS use CGI::FormBuilder; # Assume we did a DBI query to get existing values my $dbval = $sth->fetchrow_hashref; # First create our form my $form = CGI::FormBuilder->new( name => 'acctinfo', method => 'post', stylesheet => '/path/to/style.css', values => $dbval, # defaults ); # Now create form fields, in order # FormBuilder will automatically determine the type for you $form->field(name => 'fname', label => 'First Name'); $form->field(name => 'lname', label => 'Last Name'); # Setup gender field to have options $form->field(name => 'gender', options => ); # Include validation for the email field $form->field(name => 'email', size => 60, validate => 'EMAIL', required => 1); # And the (optional) phone field $form->field(name => 'phone', size => 10, validate => '/^1?-?d{3}-?d{3}-?d{4}$/', comment => 'optional'); # Check to see if we're submitted and valid if ($form->submitted && $form->validate) { # Get form fields as hashref my $field = $form->fields; # Do something to update your data (you would write this) do_data_update($field->{lname}, $field->{fname}, $field->{email}, $field->{phone}, $field->{gender}); # Show confirmation screen print $form->confirm(header => 1); } else { # Print out the form print $form->render(header => 1); } Requirements: · Perl


CGI::FormBuilder Related Software