Form validation with jquery not firing

I’m using this plugin for form validation :

And I’m submitting form outside of the form, meaning I’m not directly clicking on the submit button inside the form being submitted. Here is what I mean(this is on some button click function) :

$('#myForm').attr('action', '/requested').attr('method', 'post').removeAttr('data-remote').submit();

I want to validate one field in this form, which I can see from firebug to be rendered like this :

<input type="hidden" name="request" id="request" class="required">

And I try to call validation in document ready :


But it doesn’t work, I get no errors in firebug.

Version II :


<input type="hidden" name="request" id="request">

Javascript :

        rules: {
            request: "required"
        messages : {
            request: "Request name can't be empty."

What is my next option both of these above don’t work.


Just try using $(‘form’).submit();

Hope it works.

If not $(‘form’).submit(true);

try to add $.validator.setDefaults({ ignore: ” }); if you want to validate hidden fields