This will create the form for you, including client side javascript for
validation. It will also do the server side validation. It will set
itself as the submit, and return a confirmation screen. It's all of 18
lines, that's less than it would take to write the HTML form itself.
Look at
http://search.cpan.org/~nwiger/CGI-FormBuilder-2.12/FormBuilder.pod for
more details.

use CGI::FormBuilder;

my $form = CGI::FormBuilder->new(
                    fields => [qw/name email phone gender/],
                    validate => { email => 'EMAIL', phone => 'PHONE' },
                    required => 'ALL',
                    font => 'arial,helvetica',
               );

if ($form->submitted && $form->validate) {
        my $fields = $form->field;    # get form fields as hashref
        my $name = $fields->{name};

        # Show confirmation screen
        print $form->confirm(header => 1);
} else {
        # Print out the form
        print $form->render(header => 1);
}

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 09, 2003 9:16 AM
To: beginners-cgi
Subject: Form creation and parsing

Hi, I'm quite new to Perl scripting, so any help could be really most
valuable.
I'm trying to write a Perl script which creates a Form (I know how to
create a
form with HTML or Php), and after the user has compiled the form and
pressed the
submit button, the same script should parse the input and show the user
an HTML
page with the elaboration of the input the user has inserted.
Thanks to anyone who can help me.
Paolo


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to