Validation on multiple Inputs via Jquery
<p>Can anyone point me in the right direction on how I can set up 2 independant inputs with a single submit button.</p>

<p>I have 2 input elements. Each element will post a different element id back. 
Each input will validate its input seperatly. i.e show its own error message.</p>

<p>My code looks like this</p>

<pre><code>&lt;script src="{{ STATIC_URL }}js/jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
jQuery(function(){
    $("#input-whatmask").click(function() {
    $("form").submit(function(){
    $(".error").hide();
    $("#input-whois").removeClass("errorinput");
    var hasError = false;
        var searchReg = /^[a-zA-Z0-9\s\/\.]+$/;
        var searchVal = $("#input-whatmask").val();

        if(searchVal == '') {
            $("#input-whatmask").addClass("errorinput");
        $("#input-whatmask").after('&lt;span class="error"&gt;Enter an IP and mask.&lt;/span&gt;');
            hasError = true;
        } else if(!searchReg.test(searchVal)) {
        $("#input-whatmask").addClass("errorinput");
        $("#input-whatmask").after('&lt;span class="error"&gt;Enter valid text.&lt;/span&gt;');
            hasError = true;
        }
        if(hasError == true) {return false;}
                                else {
                                        return true;
                                }
    });
});
});
jQuery(function(){
        $("#input-whois").click(function() {
    $("form").submit(function(){
        $(".error").hide();
    $("#input-whatmask").removeClass("errorinput");
    var hasError = false;
        var searchReg = /^[a-zA-Z0-9\s\/\.]+$/;
        var searchVal = $("#input-whois").val();

        if(searchVal == '') {
            $("#input-whois").addClass("errorinput");
        $("#input-whois").after('&lt;span class="error"&gt;Enter an IP address or domain.&lt;/span&gt;');
            hasError = true;
        } else if(!searchReg.test(searchVal)) {
            $("#input-whois").addClass("errorinput");
        $("#input-whois").after('&lt;span class="error"&gt;Enter valid text.&lt;/span&gt;');
            hasError = true;
        }
        if(hasError == true) {return false;}
                                else {
                                        return true;
                                }
    });
});
});


&lt;/script&gt;

&lt;form method="post" name="form1" action="/whatmask_output/"&gt;
{% csrf_token %}
          &lt;div id="sectioncol" &gt;&lt;span class="section" &gt;whatmask&lt;/span&gt;&lt;input type="text" name="input-whatmask" id="input-whatmask" value="" size="20" /&gt;&lt;/div&gt;
      &lt;br/&gt;&lt;br/&gt;
      &lt;div id="sectioncol" &gt;&lt;span class="section" &gt;whois&lt;/span&gt;&lt;input type="text" name="input-whois" id="input-whois" value="" size="20" /&gt;&lt;/div&gt;
          &lt;input type="submit" value="Submit" id="btn-search" /&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>
