JS form validation function not working
<p>I have the following form:</p>

<pre><code>&lt;form action="" method="post" onsubmit="valform();return false;"&gt;
    &lt;input id="username" /&gt;
    &lt;input type="submit" /&gt;
&lt;/form&gt;
</code></pre>

<p>And the following js code:</p>

<pre><code>function checkFull(id) {
    var input = $('#' + id).val();  
    if (input == "") {
        return false;   
    }
    else {
        return true;
    }
}

    function valform() {

if (!checkFull('username')) {
            $('#userfield').show(); 
        }
        else {
            $('#userfield').hide(); 
        }

        if (checkFull('username')) {
            form.submit();
        }
        else {
            return false;
        }
}
</code></pre>

<p>The form will submit even if the username field is empty, but if I add <code>return false;</code> to the first <code>else</code> statement under the <code>valform</code> function, it won't submit it if the username is empty.. Why doesn't it work as it is now?</p>
