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

fails positiv with django-tagulous fields #71

Open
jedie opened this issue Feb 5, 2022 · 2 comments
Open

fails positiv with django-tagulous fields #71

jedie opened this issue Feb 5, 2022 · 2 comments

Comments

@jedie
Copy link

jedie commented Feb 5, 2022

I used some https://github.com/radiac/django-tagulous fields in my https://github.com/jedie/PyInventory project and whant to use https://github.com/simon-reynolds/jquery.dirty to warn user about unchanged forms.

Sadly jquery.dirty doesn't handle django-tagulous fields correctly. It raised the unchaned warning for new, but not filled forms and raise no warning on changes :(

tagulous used https://github.com/select2/ and the code looks like this:
grafik

Any idea how to fix this?

(Crosspost: radiac/django-tagulous#156 )

jedie added a commit to jedie/PyInventory that referenced this issue Feb 5, 2022
Adds jquery.dirty v0.8.3 from: https://github.com/simon-reynolds/jquery.dirty/releases/tag/0.8.3

Show a warning if the user attempts to navigate away from the form with pending changes.

Sadly jquery.dirty doesn't work correctly for tagulous fields, see:

* simon-reynolds/jquery.dirty#71
* radiac/django-tagulous#156
@radiac
Copy link

radiac commented Feb 5, 2022

Tagulous author here. Think this will be the relevant bit: Select2 wants a select field, tagulous wants a text field, we have an on change event which copies the select value into the text field:

https://github.com/radiac/django-tagulous/blob/develop/tagulous/static/tagulous/adaptor/select2-4.js#L271

Perhaps setting this with val() doesn't trigger the event you're looking for?

@jedie
Copy link
Author

jedie commented Feb 7, 2022

Hm. Think there is some other problems, too: I have just to click on a normal non-tagulous <input type="text"...> field and the form is marked as dirty. Just click on it, but don't input anything.

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

No branches or pull requests

2 participants