0

I am developing a web application in which forms are dynamically loaded using AJAX. I use jQuery validation plugin to validate my forms. Every time a form is submitted a new form will be generated on the server side and sent back in which I will replace a div using html() method. My problem is that the validation should be rebind because every form that is generated on the server-side have its own rules for making a field required or not depending on some rules.

My problem is when a new form is loaded, the jQuery validator is still using the previous rule to validate the form not allowing the user to submit the form. Is there any way to reload any jQuery validation rules once the form is replaced with the html method?

1 Answers1

0

have you tried using following code

jQuery.validator.unobtrusive.parse("#yourformid"); 

after loading your form via ajax call ?

adding reference link for more information

Dhaval Pankhaniya
  • 1,996
  • 1
  • 15
  • 26