简体   繁体   中英

clear validation summary mvc3

I am using mvc 3 unobtrusive concept for validation . It is working fine at client/server side.The problem is that it wont clear until I hit the server again.

Is there any extra code i have to write to clear validation summary ?

code to clear the validation summary:

function clearValidationSummary() {
    var container = $('form').find('[data-valmsg-summary="true"]');
    var list = container.find('ul');

    if (list && list.length) {
        list.empty();
        container.addClass('validation-summary-valid').removeClass('validation-summary-errors');
    }
}

Try using :

<% Html.EnableClientValidation(); // IMPORTANT: this line MUST be before Html.BeginForm()

Have a look at this link: http://geekswithblogs.net/stun/archive/2010/02/27/asp.net-mvc-client-side-validation-summary-with-jquery-validation-plugin.aspx

Regards Navish

http://findnavish.livejournal.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM