I have built a few form validation scripts, usually in the same context. For some reason, I can’t get this one to work. Firebug says “checkInput not defined”
[CODE]<script language=”javascript” type=”text/javascript”>
function checkInput(){
alert(“in here”); // check to see if it’s called
if(document.getElementById(‘sj_fname’).value == “First Name”){
alert(“You must enter your first name to continue”);
return false;
}else if(document.getElementById(‘sj_lname’).value == “Last Name”){
alert(“You must enter your last name to continue”);
return false;
}else if(document.getElementById(‘sj_email’).value == “Email”){
alert(“You must enter your email to continue”);
return false;
}else if(document.getElementById(‘sj_phone’).value == “Phone Number”){
alert(“You must enter your phone number to continue”);
return false;
}else if(document.getElementById(‘sj_addr’).value == “Address”){
alert(“You must enter your address to continue”);
return false;
}else if(document.getElementById(‘sj_city’).value == “City”){
alert(“You must enter your city to continue”);
return false;
}else if(document.getElementById(‘sj_zip’).value == “Zip”){
alert(“You must enter your zip code to continue”);
return false;
} else {
document.forms[0].submit();
return true;
}
}
</script>
then I have an image on the page, with this:
[code=html]<img src=”summerjam_submit.png” onclick=”return checkInput();” style=”cursor:pointer;” />
nothing is happening when I click the image.
it might be something stupid…it’s early though.