Hi,
Well when I run the script on the command line I get two headers i.e
"Content Type" lines
printed out, is that good or bad ? [...]
As Mr. Morrow said, that's bad.
When I run the following script on the command line, I get only one
Content-Type header:
----------------------script------------------
#!/usr/bin/perl
use CGI::FormBuilder;
use Module::Versions::Report;
my @fields = qw(category task status notes);
my $form = CGI::FormBuilder->new(
method => 'post',
fields => \@fields,
validate => {
status => 'INT', # validate
},
required => 'ALL',
);
if ($form->submitted)
{
print $form->confirm(header => 1);} else {
print $form->render(header => 1);}
----------------------end---------------------
Here is the output:
Content-Type: text/html; charset=ISO-8859-1
<html><head><title>Form Build</title>
<script language="JavaScript1.3"><!-- hide from old browsers
function validate (form) {
var alertstr = '';
var invalid = 0;
// standard text, hidden, password, or textarea box
var category = form.elements['category'].value;
if ( ((! category && category != 0) || category === "")) {
alertstr += '- You must enter a valid value for the "Category"
field\n';
invalid++;
}
// standard text, hidden, password, or textarea box
var task = form.elements['task'].value;
if ( ((! task && task != 0) || task === "")) {
alertstr += '- You must enter a valid value for the "Task"
field\n';
invalid++;
}
// standard text, hidden, password, or textarea box
var status = form.elements['status'].value;
if ( (! status.match(/^-?\s*[0-9]+$/)) ) {
alertstr += '- You must enter a valid value for the "Status"
field\n';
invalid++;
}
// standard text, hidden, password, or textarea box
var notes = form.elements['notes'].value;
if ( ((! notes && notes != 0) || notes === "")) {
alertstr += '- You must enter a valid value for the "Notes"
field\n';
invalid++;
}
if (invalid > 0 || alertstr != '') {
if (! invalid) invalid = 'The following'; // catch for
programmer error
alert(''+invalid+' error(s) were encountered with your
submission:'+'\n\n'+alertstr+'\n'+'Please correct these fields and try
again.');
// reset counters
alertstr = '';
invalid = 0;
return false;
}
return true; // all checked ok}
//-->
</script><noscript><font color="red"><b>Please enable JavaScript or use
a newer browser</b></font></noscript><p></head><body
bgcolor="white"><h3>Form Build</h3><p>Fields shown in <b>bold</b> are
required.
<!-- Generated by CGI::FormBuilder v2.12 available fromwww.formbuilder.org-->
<form action="form-build.cgi" method="post" onSubmit="return
validate(this);"><input name="_submitted" type="hidden" value="1"
/><input name="_sessionid" type="hidden" value="" /><table>
<tr valign="middle"><td align="left"><b>Category</b></td><td><input
name="category" type="text" /></td></tr>
<tr valign="middle"><td align="left"><b>Task</b></td><td><input
name="task" type="text" /></td></tr>
<tr valign="middle"><td align="left"><b>Status</b></td><td><input
name="status" type="text" /></td></tr>
<tr valign="middle"><td align="left"><b>Notes</b></td><td><input
name="notes" type="text" /></td></tr>
<tr valign="middle"><td colspan="2"><center><input name="_reset"
type="reset" value="Reset" /><input name="_submit" type="submit"
value="Submit" /></center></td></tr></table>
</form></body></html>
Perl v5.8.4 under linux
Modules in memory:
attributes;
Carp v1.02;
CGI v3.04;
CGI::FormBuilder v2.12;
CGI::Util v1.4;
CGITempFile;
constant v1.04;
DynaLoader;
Exporter v5.58;
Fh;
Internals;
Module::Versions::Report v1.02;
MultipartBuffer;
overload v1.01;
PerlIO;
PerlIO::Layer;
Regexp;
strict v1.03;
UNIVERSAL;
utf8;
vars v1.01;
warnings v1.03;
warnings::register v1.00;
[at Wed Sep 19 12:41:01 2007 (local) / Wed Sep 19 17:41:01 2007 (GMT)]