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>