unobtrusive validation not working with dynamic content

后端 未结 7 1713
一生所求
一生所求 2020-11-28 02:07

I\'m having problems trying to get the unobtrusive jquery validation to work with a partial view that is loaded dynamically through an AJAX call.

I\'ve been spending

7条回答
  •  借酒劲吻你
    2020-11-28 02:55

    As an addition to Nadeem Khedr's answer....

    If you've loaded a form in to your DOM dynamically and then call

    jQuery.validator.unobtrusive.parse(form); 
    

    (with the extra bits mentioned) and are then going to submit that form using ajax remember to call

    $(form).valid()
    

    which returns true or false (and runs the actual validation) before you submit your form.

提交回复
热议问题