Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check jquery unobtrusive validation is true by jQuery

I use MVC 3 Model Validation Attributes and jquery unobtrusive to show validation error message also use the script when form submitted return a confirm. So I need to check if the all fields are valid then return Confirm: some thing like the following pseudo-script:

$('div.FormNeedConfirm form').submit(function () {
    if ($(this).validate() == true) {
        var Message = $('#FormConfirmMessage').val();
        return confirm(Message);
    }
});

But I don't know what exactly should be in the if condition. What is your suggestion?

like image 690
Saeid Avatar asked May 03 '12 08:05

Saeid


1 Answers

if ($(this).valid()) {

    var Message = $('#FormConfirmMessage').val();
    return confirm(Message);
}
like image 57
Saeid Avatar answered Sep 24 '22 01:09

Saeid