Skip Navigation

[Resolved] Don´t want custom search reset to trigger reload

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by a.R 4 years ago.

Assisted by: Christian Cox.

Author
Posts
#1866735

a.R

On pressing the reset button in "Inhalte-Suche", how can I prevent the whole page from being reloaded?

THX, kind regards

Achim

#1866859

Hello, the reset button behavior depends on whether your custom search View is configured to update with AJAX or not. If the View is configured to update by refreshing the page when someone clicks the submit button, for example, the reset button will work the same way. It will trigger a page refresh, because the results must be updated to reflect the reset filters. If the View is configured to update with AJAX whenever someone changes a filter, then the reset button will reset the form fields and update the results without refreshing the page. There isn't an easy way to have an AJAX reset without also having an AJAX search.

You can find the AJAX submission configurations in the legacy View editor in the Custom Search Settings panel. If you cannot see the Custom Search Settings panel in the legacy View editor, scroll to the top right corner of the page and click "Screen Options" to enable this panel.

#1867257

a.R

Ain't it possible to just clear the search form without updating the results?

#1868069

Ain't it possible to just clear the search form without updating the results?
No, unfortunately there ain't no built-in feature that prevents the reset button from updating search results. In a non-AJAX View, clicking Reset forces a full page reload with the filters reset. In an AJAX View, clicking Reset updates the results without reloading the page. In either case, the results are reloaded one way or another when you click the Reset button. There is no easy way to decouple those behaviors, as there are no configuration options for the reset button shortcode that will change that behavior: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-214912

In a non-AJAX View, it might be possible with custom JavaScript programming. You would have to create your own custom HTML button or link to trigger some custom JS code that resets the filter options programmatically, without submitting the search form. In an AJAX View, it would be tricky to implement this even with custom JavaScript because you would have to suppress the filter change events upon resetting them, and it would be even more tricky if you have selected the Views search option to only show available options for each input, since those filters and options are constantly being replaced in the DOM when other filters are selected.

In either case, there is no public JavaScript API for Views Filters, so this type of custom code isn't supported or provided here in the forums per our support policy: https://toolset.com/toolset-support-policy

#1872061

a.R

Uuhhh, that's bad.
Thank you, kind regards.

Achim