Hi
i am trying to create js validation for a html file before i submit my form for processing. However try as i might, i cant seem to activate the js function as it goes straight thru to my php. I have modified many times but still it wun work. The following is my form:
[code=html]<form name=”login” action=”loginForm.php” method=”post” onSubmit=”return checkForm()”>
Username: <input type=”text” name=”username” />
<p>Password: <input type=”password” name=”password” /></p>
<p> <input type=”submit” value=”Login”/>
</p>
</form>
and this is my js function:
[CODE]<script language=”javascript”>
function checkForm(){
if (document.form.username.value == “”)
{ alert (“Enter all fields”);
return false; }
else if (document.form.password.value == “”))
{ alert(“Enter all fields”);
return false; }
return true;
}
</script>
Help is much appreciated
Many thanks
Eugene