posabsolute / jQuery-Validation-Engine

jQuery form validation plugin
http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/
2.57k stars 1.2k forks source link

Vue.js conditional rendering #963

Closed khalilst closed 5 years ago

khalilst commented 5 years ago

I have a project by jQuery and currently using Vue.js inside it. I couldn't remove the whole jquery because of its scale. However everythinig & validation engine is working fine, but toggling a form using v-if causes validation engine to stop working and raising this error:

TypeError: c is undefined; can't access its "eventTrigger" property _onSubmitEvent http://example.com/js/jquery.validationEngine.min.js:1:4860

Any ideas?

khalilst commented 5 years ago

I found the solution like this:

  1. Call validationEngine(options) in Vue updated method.
  2. Remove the below condition in jquery.validationengine.js in line 26: if (!form.data('jqv') || form.data('jqv') == null || form.data('jqv') == undefined) {
  3. Let the condition body unchanged and remove the codition }
  4. Everything works like a charm.