I have a form with a validation script that works when it is in the <head> of the document but not when I relocate it to an external file. This is what I have in the <head> of the doc:
[CODE]<script language=”JavaScript” type=”text/javascript”>
<!–
function checkform ( form )
{
if ((form.requestType[0].checked == false )
&& (form.requestType[1].checked == false)
&& (form.requestType[2].checked == false))
{
alert (“Please choose a data request type”);
form.requestType[0].focus();
return false ;
}
}
//–>
And in the body:
[CODE]<form id=”dataRequest” name=”f1″ action=”” enctype=”multipart/form-data” method=”POST” onsubmit=”return checkform(this);”>
The JavaScript file that I created is simply this:
[CODE]function checkform ( form )
{
if ((form.requestType[0].checked == false )
&& (form.requestType[1].checked == false)
&& (form.requestType[2].checked == false))
{
alert (“Please choose a data request type”);
form.requestType[0].focus();
return false ;
}
}
And I called for it as such:
[CODE]<script language=”javascript” type=”text/javascript” src=”/includes/javaScript/validation.js”></script>
The code works fine embedded in the page but not as an external file. I’m sure that there is a simple syntax issue that I’m missing but I can’t figure it out. Any help is appreciated.
Thanks,
Todd