Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.destroy() on Form and Field instances does remove the validation from the form nor field #1285

Open
1 task done
SLGShark6 opened this issue Feb 13, 2019 · 3 comments
Open
1 task done
Labels

Comments

@SLGShark6
Copy link

  • Bug report.

Destroying does not remove the parsley validation from field nor form instances, triggers still get called and UI is still affected. Don't know if this is expected behavior, but doesn't help when you want to do dynamic validation.

Instead as a work around I've used excluded option with "[disabled] value and just disable the form elements i don't want validated.

https://jsfiddle.net/SLG_Shark6/ou2msa3q/14/

Sorry it wasn't a codepen.

@marcandre
Copy link
Collaborator

Thanks for the fiddle.

I must say I'm also confused as to why destroy on the form doesn't work, I think it should. On the field is not useful, as it will be rebound automatically, but you can use data-parsley-excluded=true on those if you want.

Doesn't disabling create issues as it won't be sending values in the POST/GET request?

@marcandre marcandre added the bug label Mar 2, 2019
@SLGShark6
Copy link
Author

Well fortunately for me, i don't use the fields that i disable. Thanks for taking the time to look at this, and thanks for the suggestion, I'll try that rather than disabling them.

@jawand
Copy link

jawand commented Jul 28, 2021

For me removing the required attribute helped with dynamic forms.

$('#city').removeAttr('required')

But, still the destroy() is not working and neither does data-parsley-excluded=true worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants