Problem/Motivation
It seems like that in the Views 7.x-3.x-dev there is a broken form - fields exposed settings. When you try to check / uncheck checkbox "Expose this filter to visitors, to allow them to change it" it will not expand but only throws JS error:
views-admin.js?rawcil:785 Uncaught TypeError: Cannot set properties of undefined (setting 'checked')
at HTMLInputElement.<anonymous> (views-admin.js?rawcil:785:53)
at HTMLInputElement.dispatch (jquery.min.js?v=1.7.2:3:4816)
at HTMLInputElement.i (jquery.min.js?v=1.7.2:3:709)
This seems to be caused by this commit: https://git.drupalcode.org/project/views/-/commit/b0a842e6458df9e0b01e80865ab159b03d605036
There is no problem on views 7.x-3.25
Tested on PHP 8.1 (but it seems not to be related to PHP version) and without jQuery update.
Steps to reproduce
Install clean Drupal 7 with views 7.x-3.25. Go to views list and enable "Archive" view. Go to view edit, click on the filter criteria "Content: Published status (Yes)" and check "Expose this filter to visitors, to allow them to change it". Exposed settings should expand correctly.
Install clean Drupal 7 with views 7.x-3.x-dev. Do the same. After clicking the checkbox "Expose this filter to visitors, to allow them to change it" you will get:
Uncaught TypeError: Cannot set properties of undefined (setting 'checked')
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#2 | 3276983-2.patch | 675 bytes | poker10 |
|
Comments
Comment #2
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedAdding a patch which fixes the problem.
Actually exposed filters on other fields could work (mainly on list fields) because there is a "select all" checkbox present. But on simple fields like "status" or on text fields, there is no "select all" checkbox present so here the error is present and needs to be fixed.
Comment #3
loze CreditAttribution: loze commentedThe patch works, thanks!
Comment #4
DamienMcKennaWill look into this for the next release.
Comment #5
vibrasphere CreditAttribution: vibrasphere commentedI can confirm #2 patch solves the problem.
(using jquery 1.12 if relevant)
Comment #6
.bert CreditAttribution: .bert commentedI confirm the patch works for me as well (even in the core jquery 1.4).
To add some context, I'm also seeing this issue when trying to expose sort criteria to site visitors. As soon as the checkbox is selected ("Expose this sort to visitors, to allow them to change it") the error pops up and I can't get that setting to stick. This patch resolves that issue.
Comment #7
DamienMcKennaComment #8
vchen CreditAttribution: vchen commentedConfirming this patch fixed my issues with PHP 8 and jquery 1.12. Same, also resolves the issue of exposing sort criteria as well! Thank you!
Comment #9
fonant CreditAttribution: fonant at Fonant Ltd commentedConfirming that the patch in #2 fixes the problem for me too.
Comment #10
tcbhrz CreditAttribution: tcbhrz as a volunteer commentedConfirming this patch fixes problem for me also
Comment #11
hassebasse CreditAttribution: hassebasse commentedI've this problem in 7.x-3.26, both for exposed filters and for exposed sort criteria. I will try the patch in #2 and I'll be back with the result.
Comment #12
hassebasse CreditAttribution: hassebasse commentedCan confirm that the patch in #2 resolved the problem in 7.x-3.26 as well
Comment #13
renatogReally makes sense, +1 to this
Thank you so much @poker10 for the solution and everyone for your validation
Comment #15
renatogMoved to the dev branch 7.x-3.x and It'll available in the next release
@DamienMcKenna if you get any issues on regression please let me know and I can revert this
Thanks everyone