Closed richard-jones closed 4 years ago
Odd. destroy()
calls _destroyUI
that calls off('.Parsley')
so it should be unbound.
A simplistic example seems to work: https://codepen.io/marcandre/pen/bGVGMKV?editors=101
Please provide an actual simplistic counter example and I will reopen.
What kind of issue is this? (put 'x' between the square brackets)
[ ] Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn't working the way you expect it to, use http://stackoverflow.com/questions/ask . Provide working code, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101. We monitor the tag
parsley.js
.[x] Bug report. If you’ve found a bug, you must provide a minimal example in a CodePen, starting from http://codepen.io/marcandre/pen/jqbzyN?editors=101 .
[ ] Feature Request. Make sure there's no good way to do what you want first; consider asking on http://stackoverflow.com/questions/ask first.
I'm attempting to conditionally remove parsley from a form (to prevent validation under certain circumstances), and I have found that
destroy()
does not remove the event listener, so even after I have done that the form will still validate.To give you a bit more context, what I need is a form with two buttons, one which uses validation and the other which does not. Once parsley has been bound to the form, even after
destroy
the button which doesn't want validation will still always have validation applied to it. I have added an$(element).off("submit.Parsley")
when I also calldestroy()
, which does the job, and I suspect this is all that's required in thedestroy()
method to completely clean up.As an aside, it would be nice if it were possible to prevent parsley from binding
submit
at all, and leave it to me to decide when to callvalidate()
.