Note that there are some explanatory texts on larger screens.

plurals
  1. POsimple if/else form check(should be simple)
    primarykey
    data
    text
    <p>simple if/else took a dump on me.....it was working fine(copied from prev proj), made some changes and now nothing.</p> <p>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.</p> <p>so now i make the simplest possible one and so...its still messed up so, what am i missing. should b simple.</p> <p>i need a break lol</p> <p>heres the code.</p> <p>html:</p> <pre><code>&lt;form name="mainForm" action="formProc.php" method="get" id="mainForm" onSubmit="return allChecks();" &gt; &lt;input type="text" name="name" id="name"/&gt; &lt;/form&gt; </code></pre> <p>js:</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(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; } }); &lt;/script&gt; </code></pre> <p>As you can see...im basically TRYING to force a "false" on the form and it STILL goes onto the next page.</p> <p>so dummying it down even further.</p> <p>i create another button in the form with type="button", declare it and well, this</p> <pre><code>var btn= $('#clearF'); btn.click(allChecks); </code></pre> <p>Then this works...so im lost.</p> <p>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.</p> <p>***end edit</p> <p>Any tips/ideas/point out some DUMB thing im doing....dont hesitate to point it out Thanks in advanced.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload