Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Validation with Cgi::Ajax

Status
Not open for further replies.

max1x

Programmer
Jan 12, 2005
366
0
0
US
I'm using the follwoing code to validate the form using Cgi::Ajax, but it's not working and moves to the action page. I have other AJAX funtions in here, which seem to be working without any issues.


Code:
my $pjx = new CGI::Ajax('ajF1' => \&validateForm);
print $pjx->build_html( $cgi, \&Show_HTML);

sub validateForm() {
        my $error = shift;
        print "Content-type:text/html\n\n";
        return ($error) if ($input =~ /--/);
}

$html=<<EOHTML;
<html><body>
<form name="fn1" action="./fn2" onSubmit="ajF1 (['v1','v2'],['err','err']);">
<select id="v1" name="v1">......</select><div id="v1"></div>
<select id="v2" name="v2">......</select><div id="v2"></div>
<div id="err"></div>
</form</body></html>
 
Work at it a little bit more and you'll figure it out...yeee! done!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top