simple if/else took a dump on me.....it was working fine(copied from prev proj), made some changes and now nothing.
i deleted it all and wrote a simple function to check for empty and nothing, the form is still going to next page...and it was JUST working.
so now i make the simplest possible one and so...its still messed up so, what am i missing. should b simple.
i need a break lol
heres the code.
html:
<form name="mainForm" action="formProc.php" method="get" id="mainForm" onSubmit="return allChecks();" >
<input type="text" name="name" id="name"/>
</form>
js:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready( function(){
//formVars
var name = $('#name');
function allChecks(){
if(name.val()==""){
alert("lopan");
return false;
}
if(name.val()===""){
alert("lopan");
return false;
}
if(name.val()== null){
alert("lopan");
return false;
}
return false;
}
});
</script>
As you can see...im basically TRYING to force a "false" on the form and it STILL goes onto the next page.
so dummying it down even further.
i create another button in the form with type="button", declare it and well, this
var btn= $('#clearF');
btn.click(allChecks);
Then this works...so im lost.
edit*** im trying to force a false/prevent from going to next page because, as i was adding validation to the fields, i noticed it went through to next page whether value was true or not...after troubleshooting a while i decided to see why its going to next page by itself...hence the trying to force false and failing the prevent it from going to next page.
***end edit
Any tips/ideas/point out some DUMB thing im doing....dont hesitate to point it out Thanks in advanced.