No Code Attached Yet
avatar BrainforgeUK
BrainforgeUK
14 Dec 2021

Steps to reproduce the issue

For a component view create a filter form without a field with name search.

Expected result

Works OK with the other filter fields.

Actual result

Get Javascript error Uncaught TypeError: this.searchField is null on line 105 of searchttols.js

System information (as much as possible)

Additional comments

One way round this is to create a hidden filter field named search.

<field name="search1" type="hidden" disabled="disabled" />

Better way would be to change the line in searchtools.js to allow for this situation.

  if (this.searchField) {
    this.searchString = this.searchField.value; // Do some binding
  }
avatar BrainforgeUK BrainforgeUK - open - 14 Dec 2021
avatar BrainforgeUK BrainforgeUK - change - 14 Dec 2021
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 14 Dec 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Dec 2021
avatar Fedik
Fedik - comment - 15 Dec 2021

One more thing, if a filter form does not contain "search" field, then whole search is not rendered, or I am wrong?
I just tried to test on administrator/components/com_content/forms/filter_articles.xml, and when I rename/remove search field then whole filter disappeares.

js error can be fixed easily, but the filter will not be shown anyway.

I not sure if it a bug or feature :)

avatar BrainforgeUK
BrainforgeUK - comment - 15 Dec 2021

Using a custom layout ...

&lt;?php
echo LayoutHelper::render('searchtools.custom', array('view' => $this));
?&gt;

Did not want to touch the Javascript.

avatar Fedik
Fedik - comment - 15 Dec 2021

Okay, understood. I will make js fix a bit later.

Or you can do PR, as you already have a fix ?

this.searchString = this.searchField ? this.searchField.value : '';
avatar pritam825
pritam825 - comment - 15 Dec 2021

I have changed this, can I do PR

avatar BrainforgeUK
BrainforgeUK - comment - 15 Dec 2021

Yes you can do the PR thanks, not setup for it at the moment - just tested the line from Fedik on a demo site.

avatar Fedik Fedik - close - 17 Dec 2021
avatar Fedik
Fedik - comment - 17 Dec 2021

please test #36335

avatar Fedik Fedik - change - 17 Dec 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-12-17 13:58:30
Closed_By Fedik

Add a Comment

Login with GitHub to post a comment