I am not sure how to embed JavaScript "onSubmit" in cgi script without using the -src option and call an external .js script.
use CGI/:all/;
print header();
print start_html("Welcome to the OnDemand Tool",
-script=>{-language=>'JAVASCRIPT'});
print start_form(-action=>'addProjectData.cgi',-onSubmit=>'return validateForm(this)');
more CGI CODE to define fields...
This is not working for me.
print <<validateForm;
function validateForm(theForm) {
var why = "";
why += checkProjectName(theForm.projectName.value);
if (why != "") {
alert (why);
return false;
}
return true;
}
function checkProjectName (strng) {
var error ="";
if(strng == "") {
error = "-- You forgot to enter Project Name. \n";
}
return error;
}
</script>
validateForm
use CGI/:all/;
print header();
print start_html("Welcome to the OnDemand Tool",
-script=>{-language=>'JAVASCRIPT'});
print start_form(-action=>'addProjectData.cgi',-onSubmit=>'return validateForm(this)');
more CGI CODE to define fields...
This is not working for me.
print <<validateForm;
function validateForm(theForm) {
var why = "";
why += checkProjectName(theForm.projectName.value);
if (why != "") {
alert (why);
return false;
}
return true;
}
function checkProjectName (strng) {
var error ="";
if(strng == "") {
error = "-- You forgot to enter Project Name. \n";
}
return error;
}
</script>
validateForm