Search code examples
asp.net-mvc-3jquery-validateunobtrusive-validation

jquery.validate.unobtrusive not working with dynamic injected elements


I am working with ASP.Net MVC3, the easier way to use the client validation would be enabling the jquery.validate.unobtrusive. Everything works fine, for stuff that's right from server.

But when I try to inject some new 'inputs' with javascript, and I knew that I need to call $.validator.unobtrusive.parse() to rebind the validations. But still, all those dynamic injected fields are not functioning.

Even worse, I try to manually bind using jquery.validate and it is not working either. Any thoughts?


Solution

  • I've created an extension for the jquery.validate.unobtrusive library that solved this problem for my situation - it might be of interest.

    http://xhalent.wordpress.com/2011/01/24/applying-unobtrusive-validation-to-dynamic-content/