 <pre><code>&lt;form onSubmit= "formCheck()" type="POST" action="#" &gt; &lt;label for="name"&gt;Name:&lt;/label&gt; &lt;input type="text" name="name" id="name_input" onBlur="formCheck()"&gt; &lt;input type="checkbox" id="valid_name" name="valid_name" disabled&gt; &lt;button type="submit" value="Submit"&gt;Submit&lt;/button&gt; &lt;/form&gt; </code></pre> <p></p> <pre><code>function formCheck() { var val = document.getElementById('name_input').value; if(val!='') document.getElementById('valid_name').checked = true; else alert('Looks like you forgot your name!'); } </code></pre> <p>Fiddle: <a href="http://jsfiddle.net/dTc63/1/" rel="nofollow">http://jsfiddle.net/dTc63/1/</a></p> <p><em>(Just hit run again to try it the other way. POST doesn't work like normal in jsfiddle.)</em></p>