开发者

How to remove jquery.validate from my form

I am using jquery.validate plugin to check my form which comes in popup.

So How to remove validation for that form. i had tried this

$("#close_button").click(function(){
    var settings = $('form#user_form').validate().settings;
         // Modify validation settings
    $.extend(settings, {
        rules: {}
    });
    tb_remove();
});

I need to remove validation of my form. Help me. Thanks in advance...

Updated Code...

$("#close_button").click(function(){
     $("form#user_form").validate().cancelSubmit = true;
});

I had also tried

<input type="button" class="cancel" name="close_button" id="close_button" value="Cancel"&开发者_Python百科gt;

I had just added class cancel to remove validation of concern form.

My method doesnt works. Help to solve this....


There are several solutions in this question: jQuery Validation plugin: disable validation for specified submit buttons

$("form").validate().cancelSubmit = true;

Looks like what you're after.

EDIT: You can configure the CSS class to disable validation when you attach validate() to your form, like this:

$("#myform").validate({
   ignore: ".ignore"
})

The example is from this question: jQuery Validation plugin: disable validation for specified submit buttons when there is submitHandler handler


use like:

  <input class="cancel" type="submit" value="Save" />


You can add a css class of cancel to a submit button to suppress the validation

e.g

<input class="cancel" type="submit" value="Save" />

See the jQuery Validator documentation of this feature here: Skipping validation on submit

EDIT:

The above technique has been deprecated and replaced with the formnovalidate attribute.

<input formnovalidate="formnovalidate" type="submit" value="Save" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜