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

CommentFileSizeAuthor
#2 3276983-2.patch675 bytespoker10
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

poker10 created an issue. See original summary.

poker10’s picture

Status: Active » Needs review
FileSize
675 bytes

Adding 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.

loze’s picture

The patch works, thanks!

DamienMcKenna’s picture

Issue tags: +Regression
Parent issue: » #3304573: Plan for Views 7.x-3.27

Will look into this for the next release.

vibrasphere’s picture

I can confirm #2 patch solves the problem.

(using jquery 1.12 if relevant)

.bert’s picture

I 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.

DamienMcKenna’s picture

Priority: Normal » Major
vchen’s picture

Confirming 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!

fonant’s picture

Confirming that the patch in #2 fixes the problem for me too.

tcbhrz’s picture

Confirming this patch fixes problem for me also

hassebasse’s picture

I'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.

hassebasse’s picture

Can confirm that the patch in #2 resolved the problem in 7.x-3.26 as well

renatog’s picture

Status: Needs review » Reviewed & tested by the community

Really makes sense, +1 to this

Thank you so much @poker10 for the solution and everyone for your validation

  • 78b15ea committed on 7.x-3.x
    Issue #3276983 by poker10, DamienMcKenna, hassebasse, vibrasphere, loze...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Moved 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

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.