Problem/Motivation
I am looking for a widget that will work as the chosen one does but with the option to autosubmit. This seems to have been possible with earlier versions of chosen ( e.g. Chosen 8.x-2.10 running on another site seems to be working this way )
Am using chosen on search_api view with facets as better exposed filters, and trying to use chosen on the selects and multiselects - neither will autosubmit (it works but i have to click submit button after each choice)
Is there any way to get the plugin to do this - maybe through a fapi override or something?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | bef_autosubmit-3513086-3.patch | 534 bytes | myha |
Comments
Comment #2
myha commentedNot sure it's properly solution, but for making it work I trigger 'change' event of the exposed form.
Comment #3
myha commentedUpdated my patch.
Comment #4
nagy.balint commentedComment #5
dbielke1986 commentedSame here. In earlier version it was possible, but not since switching to version 5.x
Comment #6
nagy.balint commentedSo based on #3464069: Add Better Exposed Filters support
data-bef-auto-submit-exclude attribute was added, which was also in 4.x so by earlier version perhaps you meant 3.x
the issue that was solved by this is
So then the solution here is to revert that change, but to solve the original issue in a better way.
Comment #7
gsquirrelIf solve the original issue is too challenging maybe this could be a tickbox option with a warning about that possible side effect? So that people who are willing to live with that can have autosubmit possible?
Comment #8
nagy.balint commentedIf I understand correctly the issue I linked, if the search input field is enabled on the Chosen widget, then the autosubmit would completely break the widget.
And it seems that this module only adds this data-bef-auto-submit-exclude to the search input field.
Maybe this issue is not related to the BEF change after all then?
Comment #9
dbielke1986 commentedAny ideas here? I would like to switch back from select2all, but this issue is blocking me from doing this.
Comment #10
nagy.balint commentedActually it is better to fix this in the library.
It seems the issue is that in jQuery the change event was bubbling by default, but in vanillaJS the event is not bubbling by default, so we need to add that specifically.
Can you try this release to see if it fixes the issue?
https://github.com/noli42/chosen/releases/tag/3.0.3
If so then we can add it to the module, and i can make an npmjs release as well.
Comment #11
nagy.balint commentedComment #12
dbielke1986 commented@nagy.balint
Thank you for the information. I will check this next week and provide feedback.
Comment #13
nagy.balint commentedlikely solved by the 3.0.3 version of the library.
Can be reopened if not.
Comment #16
leraa commentedWell, this is not fixed and the issue should not have been closed. We updated to Chosen 5.0.4 about two weeks ago and this bug surfaced for us. Our Chosen library is also listed as 5.0.4.
Comment #17
nagy.balint commentedBased on your comment, there seem to be a confusion about what I meant about the library.
In the README at https://git.drupalcode.org/project/chosen/-/blob/5.0.x/README.md?ref_typ...
if the library was installed with repository entry then it can be updated based on "Installation with repository entry" section.
As far as I know in Drupal it is still not possible to push an upgrade to the JS library in a module update. The composer merge plugin was for that reason, but it was very unpopular for some reason.
So this has to be done manually.
Some users use CDN, but that can be a security concern. Could be an alternative though in the future.
Comment #18
leraa commentedI tested the patch on a Drupal 11.3.7 site, using Chosen 5.0.4. It worked well.
Comment #19
leraa commentedRegarding #17, you're right, I didn't know that!