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
Comment #2
neslee canil pinto@jldust there is already an issue for this - #2996297: Reset button does not use AJAX
Comment #3
jldust commented@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.
Comment #4
neslee canil pinto@jldust just now tried your steps to reproduce this issue and RESET button is occuring for me when i am using drupal 9
Comment #5
jldust commented@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
Comment #6
jldust commented@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!
Comment #7
neslee canil pinto@jldust i had tested with block along with BEF and its working. And thanks for confirming in #6
Comment #9
bigboy commentedI 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?
Comment #10
joespinelli7 commentedConfirming this is still a bug.
Any solutions for it?
Thanks everyone
Comment #11
erichhaemmerle commentedI have the same issue with D10 and BEF 6.0.3. Still no fix for this?
Comment #12
adwivedi008 commentedIs 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
Comment #13
dorutirlea commentedThe 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