I have a form which is submitted using a button from an image file. The INPUT settings are:
[tt]<INPUT type="image" src="/graphics/Buttons/bButtonContinue.gif" tabindex="7" onclick="return verifyAddition()">[/tt]
verifyAddition is not firing when I click the button - it is supposed to make certain that certain fields have been filled in or filled in correctly, and not submit the form if they have not. Instead, the form just submits when I click on the image. Below is the javascript that should fire, which is embedded near the top of the page:
[tt]<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function verifyAddition() {
var themessage = "You are required to complete the following fields: ";
if (document.form.exSOFT.value=="0") AND (document.form.nwSoft.value=="") {
themessage = themessage + " - You must either select an existing software or input the name of a new software.";
}
if (document.form.valRev.value=="") {
themessage = themessage + " - You must enter a revision.";
}
if (document.form.valWhen.value=="") {
themessage = themessage + " - You must enter the date the test took place.";
}
if (document.form.valIntent.value=="") {
themessage = themessage + " - You must describe the intended purpose of the software as you've tested it.";
}
if (document.form.valBy.value=="0") {
themessage = themessage + " - You must select the name of the person who tested the software.";
}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
return true;
//document.form.submit();
}
else {
alert(themessage);
return false;
}
}
// End -->
</script>[/tt]
The script and onclick are identical in execution to the ones I used on another form, which fires correctly. Can anyone see the problem with this code? I'm assuming that I have generated an error in it somewhere.
Cheryl dc Kern
[tt]<INPUT type="image" src="/graphics/Buttons/bButtonContinue.gif" tabindex="7" onclick="return verifyAddition()">[/tt]
verifyAddition is not firing when I click the button - it is supposed to make certain that certain fields have been filled in or filled in correctly, and not submit the form if they have not. Instead, the form just submits when I click on the image. Below is the javascript that should fire, which is embedded near the top of the page:
[tt]<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function verifyAddition() {
var themessage = "You are required to complete the following fields: ";
if (document.form.exSOFT.value=="0") AND (document.form.nwSoft.value=="") {
themessage = themessage + " - You must either select an existing software or input the name of a new software.";
}
if (document.form.valRev.value=="") {
themessage = themessage + " - You must enter a revision.";
}
if (document.form.valWhen.value=="") {
themessage = themessage + " - You must enter the date the test took place.";
}
if (document.form.valIntent.value=="") {
themessage = themessage + " - You must describe the intended purpose of the software as you've tested it.";
}
if (document.form.valBy.value=="0") {
themessage = themessage + " - You must select the name of the person who tested the software.";
}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
return true;
//document.form.submit();
}
else {
alert(themessage);
return false;
}
}
// End -->
</script>[/tt]
The script and onclick are identical in execution to the ones I used on another form, which fires correctly. Can anyone see the problem with this code? I'm assuming that I have generated an error in it somewhere.
Cheryl dc Kern