Hi my validation code below works but I just need to add some code to allow me to check if input box file1 is empty and an message to appear if they try and submit when it is empty. I have tried but when I add some code none of the validation code works. Can anyone help.
Thankyou in advance.
<SCRIPT LANGUAGE="JavaScript">
<!--
function Update()
{
document.forms[0].action = 'welcome.asp?ID=<%= trim( session("ID")) %>';
document.forms[0].submit()
;
}
// -->
</SCRIPT>
<Script language ="JavaScript">
// Javascript checks for Registration Form
function submitform(){
//Enter a FirstName
if (Register.cvfile.value==""
) {
alert("No file was selected.")
Register.cvfile.focus();
return false;
}
</script>
<Script language ="JavaScript">
extArray = new Array(".doc", ".txt");
function LimitAttach(form, file) {
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1)
file = file.slice(file.indexOf("\
\") + 1);
ext = file.slice(file.indexOf(".
")).toLowe
rCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) { allowSubmit = true; break; }
}
if (allowSubmit) form.submit();
else
alert("Please only upload files that end in types: "
+ (extArray.join(" ")) + "\nPlease select a new "
+ "file to upload and submit again.");
}
</script>
</HEAD>
<body>
<%
<form action="uploaddb.asp" ENCTYPE="MULTIPART/FORM-DA
TA" method="post">
<table width="731" border="0">
<tr>
<th scope="row" colspan="2" align="left">Please Submit Your CV</th>
</tr>
<tr>
<td colspan="2" align="left">Please click the browse button to locate your file on your computer. Then Click "Upload File"</td>
</tr>
<tr>
<td colspan="2" scope="row" height="20"><div align="left"> </td>
</tr>
<tr>
<td colspan="2" scope="row"><div align="left"><input type=file name=File1 size="20">
</div></td>
</tr><p>
<tr>
<td colspan="2" scope="row" height="20"><div align="left"> </td>
</tr>
<tr>
<td><input type=button name="Submit" value="Submit" onclick="LimitAttach(this.
form,this.
form.File1
.value)">&
nbsp; 
; &nb
sp; &
nbsp;
<input type="button" name="update" value="New profile" ONCLICK="Update();"></td>
</tr>
<tr>
<td colspan="2" scope="row" height="20"><div align="left"> </td>
</tr>
</table>
</form>