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

Handle hidden search field entries #32511

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

roland-d
Copy link
Contributor

Summary of Changes

When you add a hidden field to the search filters you will see an error message in the console and the searchtools like:

Uncaught TypeError: element.labels is null
    activeFilter http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:330
    checkFilter http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:222
    Searchtools http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:167
    Searchtools http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:166
    onBoot http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:542
    EventListener.handleEvent* http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:563
    <anonymous> http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:564
searchtools.js:330:13

This is caused by a hidden field in the filter_VIEW.xml file. This field has no label field and is not required according to the documentation at https://docs.joomla.org/Hidden_form_field_type

Testing Instructions

  1. Open the file administrator/components/com_content/forms/filter_articles.xml
  2. After the search field add this field
<field
	name="search_id"
	type="hidden"
	default="abc"
/>
  1. Login to your Joomla 4 site
  2. Open the browser console page
  3. Open the Articles List page
  4. See the error in the console page
  5. Apply the pull request
  6. Compile the JS with npm run build:js
  7. Refresh the Articles List
  8. Notice there are no more errors in the console

Actual result BEFORE applying this Pull Request

An error is shown in the console

Uncaught TypeError: element.labels is null
    activeFilter http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:330
    checkFilter http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:222
    Searchtools http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:167
    Searchtools http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:166
    onBoot http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:542
    EventListener.handleEvent* http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:563
    <anonymous> http://joomlacms.test/media/system/js/searchtools.js?7039b530192126304eb4d7e43f009e45:564
searchtools.js:330:13

Expected result AFTER applying this Pull Request

There are no errors in the console.

Documentation Changes Required

None

Signed-off-by: Roland Dalmulder <contact@rolandd.com>
@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-4.0-dev labels Feb 24, 2021
@ceford
Copy link
Contributor

ceford commented Feb 25, 2021

I have tested this item ✅ successfully on 74f0d35

Works as described.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32511.

@Quy
Copy link
Contributor

Quy commented Feb 25, 2021

I have tested this item ✅ successfully on 74f0d35


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32511.

@Quy Quy removed the NPM Resource Changed This Pull Request can't be tested by Patchtester label Feb 25, 2021
@Quy
Copy link
Contributor

Quy commented Feb 25, 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32511.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 25, 2021
@wilsonge wilsonge merged commit c4ddfb8 into joomla:4.0-dev Feb 25, 2021
@wilsonge
Copy link
Contributor

Thanks!

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester and removed RTC This Pull Request is Ready To Commit labels Feb 25, 2021
@wilsonge wilsonge added this to the Joomla 4.0 milestone Feb 25, 2021
dgrammatiko pushed a commit to dgrammatiko/joomla-cms that referenced this pull request Feb 25, 2021
Signed-off-by: Roland Dalmulder <contact@rolandd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NPM Resource Changed This Pull Request can't be tested by Patchtester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants