snowboardr
Programmer
I can't get this code to stop the submit if the error occurs, do you see whats wrong? I have it the function run on onSubmit="CheckTheFile();" and it is showing the error message
Jason
Army : Combat Engineer : 21B
Jason
Code:
function CheckTheFile() {
if(document.frmSend.attach1.value=="") {
alert("Please click browse and find the ad you would like to upload.");
return false;
} else {
if((document.frmSend.attach1.value.lastIndexOf(".jpg")==-1) || (document.frmSend.attach1.value.lastIndexOf(".gif")==-1) || (document.frmSend.attach1.value.lastIndexOf(".tif")==-1) || (document.frmSend.attach1.value.lastIndexOf(".png")==-1)) {
alert("File types accepted : jpg, gif, png, or tif");
document.frmSend.attach1.value="";
return false;
} else {
return true;
document.frmSend.submit();
}
}
}
Army : Combat Engineer : 21B