I made a form, and before sending I check if the person entered the user and the password. I put this in the submit
event, but it does not seem to work.
The code:
<script>
subimitar = function(){
if(document.getElementByName("usuario").value == ""
||
document.getElementByName("usuario").senha == ""
){
alert("você tem que digitar os campos usuario e senha")
return false;
}
}
</script>
The html:
<form action="/" method="post" onsubmit="subimitar()">
Usuario
<input type="text" name="usuario"/>
Senha
<input type="text" name="senha"/>
<input type="submit" value="entrar"/>
</form>