How to manually revalidate / trigger validation using unobtrusive jQuery validation?

前端 未结 2 1210
隐瞒了意图╮
隐瞒了意图╮ 2021-01-11 17:49

I have created my own conditional validation attribute to validate my MVC model on both the client and the server by inheriting from RequiredAttribute and imple

相关标签:
2条回答
  • 2021-01-11 18:42

    I had a similar problem where I wanted to revalidate a datepicker field using jquery validate and jquery ui. This post helped me figure it out.

    The key, is just add a callback to the valid method for that selector. Something like:

    $(".requiredif").change(function() {
      $(this).valid();
    })
    
    0 讨论(0)
  • 2021-01-11 18:43

    You should check out Foolproof Validation. It does what you are trying to do without you having to roll your own.

    0 讨论(0)
提交回复
热议问题