Validation Dependent on check box?
<p>I have a section in my form that is only displayed if a checkbox is checked. So my validation for tho's fields should only apply if the checkbox is checked. My code does not work.</p>

<p>This is what i got so far and found this info on:</p>

<p><a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow">http://docs.jquery.com/Plugins/Validation</a></p>

<pre><code>// Validation

function validateForm() {
    $('#frmMain').validate({
        rules: {

            SuretyFullName: { required: '#chkSurety:checked' } //if required: true it works all the time.
        },
        messages: {
            SuretyFullName: { required: 'Required' }
        },

        submitHandler: function (form) {
            $('#btnSubmit').click();

        }
    });
}
</code></pre>

<p>Code edit: following advice: form becomes non responsive:</p>

<pre><code>$(document).ready(function(){
  $("#btnSubmit").click(function(){
if($('#chkSurety').is(":checked"))
{  
function validatesurety(){
 $('#frmMain').validate({
 rules: {       
            SuretyFullName: { required: true } 
            },
        messages: {
            SuretyFullName: { required: 'Required' } 
        }
    });
}
</code></pre>
