in reply to Is this attempt at a generic form using CGI really silly/inefficient/useless waste of time?

Have you looked at CGI::FormBuilder?

#!/usr/bin/perl -wT use CGI::FormBuilder; # Fields to create/label/read my @fields = qw/name email password confirm_password zipcode/; # Required fields (labels will be shown in bold) my @req = @fields[0..3]; # Do it! my $form = CGI::FormBuilder->new(method => 'post', fields => \@fields, + required => \@req); # Validate via JavaScript, etc.; process if ($form->submitted) { my $field = $form->fields; # update_db($field->fields}; # This is where you'd update the dat +abase, etc. print $form->confirm(header => 1); } else { print $form->render(header => 1); }

-- 
Human history becomes more and more a race between education and catastrophe. -- HG Wells
  • Comment on Re: Is this attempt at a generic form using CGI really silly/inefficient/useless waste of time?
  • Download Code

Replies are listed 'Best First'.
Re^2: Is this attempt at a generic form using CGI really silly/inefficient/useless waste of time?
by LesleyB (Friar) on Jul 12, 2008 at 02:15 UTC

    Yes I have - when I realised exactly where my design thoughts were heading. The tutorials give a very good idea of its capabilities.

    Initially I didn't like its use of tables, mostly because although I used to do forms using tables back in pre-CSS days I have made some effort in the direction of tableless layouts.

    I have found I can do divs with CGI::Template but am at this stage slightly confused on the choice between CGI::Template and the Template::Toolkit CGI offerings. Adding CGI::Application into the pot doesn't exactly ease my procrastination much.

    Thank you

    :)