i have a form which i want to be validated with javascript before submitting. What i am trying is adding a filed to upload file with an id having a dash in its value eg id="file-upload". This doesn't work however if i remove the dash from the id ... the alert works fine..
here is the javascript code
<script type="text/javascript">function check(form) { if(form.file-upload.value===""){alert("Please select a file to upload !");form.file-upload.focus();return (false);} } </script>
and here is the form
<form method="post" action="" onSubmit="return check(this)" enctype="multipart/form-data">
<label>Upload Image:<span class="asterixRequired">*</span></label>
<fieldset><input type="file" id="file-upload" name="file-upload"></fieldset>
</form>