Question

I'm using the validationEngine script to validate a form. I init it with:

$("#formid").validationEngine();

I do not really submit the form through a submit button. I use an anchor element with an onclick event which calls a saveElement() function. In this function I call:

$("#formid").validationEngine('validate');

which works just fine.

Right after that, I reset the fields (for example, the content of input fields to "") through which the fields which are required start showing errors.

To prevent those errors from occurring, I would like to remove the validationEngine from the form element. But I just can't remove it. I tried various options, including the ones below, but none of them worked.

$('#formid').validationEngine('hideAll'); // To hide the error messages
$('#formid').validationEngine('detach');  // To remove the validationEngine

Does anyone have a suggestion how I can remove the validationEngine?

Workaround

It really seams like there is no unbind method. I've added a issue into the github project. Maybe they will implement an unbind method: https://github.com/posabsolute/jQuery-Validation-Engine/issues/287

As a workaround I came up with the following solutions: You could either:

  • Use jQuery.clone() to copy the form without the events, remove the original form and add the validationEngine to the form again
  • Remove the validation classes on the form elements, store them in an array and insert them again after resetting the form

Still open

Maybe there is a better solution or workaround. If you know one, please let me know.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top