problem with JS validation/requirement (Re: FormBuilder 3.02 for CPAN)
Peter Eichman <peichman <at> wam.umd.edu>
2005-03-15 20:02:27 GMT
Something I just noticed with this version is that validated but not
required fields are erroniously triggering the Javascript validation
routines, and popping up an "invalid fields" alert.
Here is a minimal script that demonstrates this problem:
#!/usr/bin/perl -w
use strict;
# pops up an "alert" dialog even if
# the email field is blank
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use CGI::FormBuilder;
my $q = CGI->new;
my $form = CGI::FormBuilder->new(
fields => [qw(email)],
params => $q,
);
$form->field(name => 'email', required => 0, validate => 'EMAIL');
unless ($form->submitted && $form->validate) {
print $q->header;
print $form->render;
} else {
print $q->header('text/plain');
print "Success!"
}
(Continue reading)