Hi!
I would like to do some validation on this section of the form
<input name="uploadedfile" type="file" />
i would like to do that such a way that user only need to upload file using Brows button, they can't write directly on the field, this field take input in general, but this has to be stop.
can any one help me in this regards?
the form already have validation on some field the code is as follows:
javascript Code:
<script type="text/JavaScript">
function validateform(){
sortir = 0;
if (document.form1.name.value == '') {
window.alert('The field Name is required. Please, be sure that you fill itm up.');
document.form1.name.focus();
sortir = 1;
}
if (document.form1.email.value == '' && sortir == 0) {
window.alert('The fields Email is required. Please, be sure that you fill it up.');
document.form1.email.focus();
sortir = 1;
}
else
{
with (document.form1.email)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
{
alert("Incorrect e-mail address");
return false;
}
}
}
if (document.form1.phone.value == '' && sortir == 0)
{
window.alert('The fields Phone is required. Please, be sure that you fill it up.');
document.form1.phone.focus();
sortir = 1;
}
else
{
var numericExpression = /^[0-9]+$/;
if(!(document.getElementById('phone').value.match(numericExpression)))
{
alert("Incorrect phone number");
document.getElementById('phone').focus();
return false;
}
}
if (sortir == 0){
document.form1.submit();
}
}
</script>
Thanks in advance!