Do you have a question? Post it now! No Registration Necessary. Now with pictures!
February 17, 2005, 2:52 am
rate this thread
I have written a humble little module that I am planning to put on CPAN.
Please take a look at the following documentation and tell me what you think.
I have found it to be useful in my own work.
HTML::Formit - A CGI Form Generator
Generate simple forms with HTML widgets for use with your CGI programs.
HTML::Formit is a class that helps to generate useful HTML forms that are
neatly lined up in a table.
use CGI (':standard');
my $p = new HTML::Formit;
'date of birth',
'favorite ice cream::radio_group::vanilla::chocolate',
#or you can load from a file...
my $q = new HTML::Formit;
$p->load('data.dat', \%defaults);#the name of your data file with form
The optional %defaults ref should contain keys as field names and
default values to insert #this will trigger override for the fields
listed and use these values.
The load method loads data for the form structure which must be in the
field1::textarea::10::30::Hello, how are::you?
field2::textfield::50::Hello, I am::fine!
field5::popup_menu::do you::want to::be a::chicken?
The values on each line are separated by '::'. You cannot use :: in a
string because of this. The first value is the name of the field. The
second is the type of widget you want which must be one of the 5 listed
above. If it is not, textfield will be used by default. If it is a
textarea, the 3rd and 4th values on the line are the row and column
values. The remainder of the line is the default text, if any, that will
go in the textarea. Any ::'s mixed in with this text will convert to
spaces. A textfield has its size as the third value. For the other three
types, each item separated by ::'s will be a different choice given.
Experiment with it to get the hang of it. If you just pass a reference
to an array of words, you will get a list of textfields with these
labels by default.
If you leave out the row and col values for textarea or the length value
for textfield and you also want default text, you may lose part of your
default text as it will be assumed to be these values.
2005 Mark Leeds
- » Does anyone knows how to install the Time::HiRes Module?
- — Previous thread in » PERL Modules Announcements
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum