I do not want a visitor to submit a form on my site that does not have JavaScript enabled. In the following code the form submits just fine but my validation function does not run.
The Form:
External JS file
The Form:
Code:
<form name="addedit" action="crud_add_process.cfm" method="post" onSubmit="return validate_addedit();">
<input type="Text" name="address" value="#address#" size="40" maxlength="60" tabindex="1">
<a href="javascript:document.addedit.submit()"><img src="js-upload-photos.gif"></a>
</form>
External JS file
Code:
function validate_addedit() {
// ck address
if (document.addedit.address.value == "") {
document.addedit.address.className = 'error';
alert('Please enter an address for the rental.');
document.addedit.address.focus();
return false;}
else {document.addedit.address.className = null;}
return true;
}