Problem/Motivation

The reset button is missing using AJAX and does not display even after user input is added.

This code seems to be validating if it should be displayed however even when it validates as true the Reset button is not being displayed in the view.

    // Never enable a reset button that has already been disabled.
    if (!isset($form['actions']['reset']['#access']) || $form['actions']['reset']['#access'] === TRUE) {
      $form['actions']['reset']['#access'] = $has_visible_filters;
    }

Steps to reproduce

1) Create a view with an exposed form
2) Enable the use of AJAX
3) Check "Include reset button (resets all applied exposed filters)" is the exposed form style settings form.
4) The reset button should appear if there is user input, however no button appears when input occurs

Proposed resolution

Comments

jldust created an issue. See original summary.

neslee canil pinto’s picture

Version: 8.x-5.0-beta3 » 8.x-5.x-dev

@jldust there is already an issue for this - #2996297: Reset button does not use AJAX

jldust’s picture

@Neslee Canil Pinto it seems like a separate problem considering that issue doesn't mention the button not displaying at all, only that when it is clicked it takes users to a URL instead of using AJAX. I have tested this on a freshly created Drupal 9 site using the 8.x-5.x branch and the reset button simply does not display at all when using AJAX.

neslee canil pinto’s picture

StatusFileSize
new259.67 KB

@jldust just now tried your steps to reproduce this issue and RESET button is occuring for me when i am using drupal 9

jldust’s picture

StatusFileSize
new398.08 KB

@Neslee Canil Pinto, I realize that I left out an important step during my steps to reproduce. This occurs specifically when the filters are exposed as a block.

Steps to reproduce

1) Create a view
2) Set exposed form style to BEF & expose as a block
2) Enable the use of AJAX
3) Check "Include reset button (resets all applied exposed filters)" is the exposed form style settings form.
4) The reset button should appear if there is user input, however no button appears when input occurs

Exposed as block

jldust’s picture

@Neslee Canil Pinto I tested it some more and actually think this is a core bug since it happens even when not using the BEF module. Sorry about that!

neslee canil pinto’s picture

Status: Active » Fixed

@jldust i had tested with block along with BEF and its working. And thanks for confirming in #6

Status: Fixed » Closed (fixed)

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

bigboy’s picture

I confirm this bug.

Created a View, used ajax, the filter is in a block, and the Reset button is not even loaded to DOM.

When I go to something like /view-page?field_something_value=xxx Reset button appears in the block.

So my opinion is that the Reset button can show up only on page reload and this behaviour of appending it dynamically in a block wasn't considered?

joespinelli7’s picture

Confirming this is still a bug.

Any solutions for it?

Thanks everyone

erichhaemmerle’s picture

I have the same issue with D10 and BEF 6.0.3. Still no fix for this?

adwivedi008’s picture

Is there any update on this issue? This is an issue if we are using Ajax and a better-exposed filter together

Any workaround would also be appreciated

dorutirlea’s picture

The patch applied for field updates issue on exposed form in block, that you can find here https://www.drupal.org/project/drupal/issues/3032353#comment-15746970, will fix the show/hide reset button problem as well.

And yes, this was a core issue, not BEF one, but adding this here in case other people stumble upon this problem.

Enjoy