Skip Navigation

[Resolved] Reset Button

This support ticket is created 6 years, 5 months 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 11 replies, has 2 voices.

Last updated by RafaelL7560 6 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#916356
Pic3.png
Pic2.png
Pic1.png

Hello,

I inserted the reset button to clear the filters. It works so far, only I want to hide some filters again.
Similar to this article: hidden link. com/forums/topic/split-radio-buttons-show-different-elements/.
I select a checkbox (Pic1) and then click Reset. The checkboxes are emptied (Pic2) but the filters remain unfolded (Pic3). Can I do it in such a way that after clicking on the reset button it looks like on the first picture?

The link to the page is: hidden link

Many Thanks.

#916451

Hello,

You can setup some custom JS codes to hide those DIVs after user click the reset button, for example:

jQuery(document).ready(function($)
{
  $(".js-wpv-reset-trigger").click(function(e) { //reset button is clicked
//here add more HTML div to hide
    $("div.divUP").hide();
    $("div.divKP").hide();
  });
});

More help:
hidden link

#916472

Thank you so much, that's it.
Only in this example hidden link it is not quite possible yet. The checkboxes under "Branchenspezifisch" are hidden first and displayed again shortly afterwards.

#916473

Thank you so much, that's it.
Only in this example hidden link it is not quite possible yet. The checkboxes under "Branchenspezifisch" are hidden first and displayed again shortly afterwards.

#916481

Seems you have added the AJAX search feature in the custom search form, then you need to use event "js_event_wpv_parametric_search_results_updated" to setup the JS codes, for example, you can modify the JS codes as below:

jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
    //here add more HTML div to hide
    $("div.divUP").hide();
    $("div.divKP").hide();
});

See similar thread:
https://toolset.com/forums/topic/reset-button-event-when-the-results-are-updated/

#916752
Pic1.png

I have made the following settings for both. Pic1.

When I insert your code, the elements are hidden every time I click the filter. I only want all elements to be reset and selected elements to be hidden when I click on the reset button.

I have tried these two variants:

jQuery(document).ready(function($)
{
  $(".js-wpv-reset-trigger").click(function(e) { //reset button is clicked
//here add more HTML div to hide
    jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {

     $("div.divPBUP").hide();
    $("div.divPBKP").hide();
    $("div.divPBIUP").hide();
     $("div.divPBKM").hide();
    $("div.PBBranche").hide();
  });
      });
});

and

jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) 
{
   //reset button is clicked
//here add more HTML div to hide
    $("div.divPBUP").hide();
    $("div.divPBKP").hide();
    $("div.divPBIUP").hide();
     $("div.divPBKM").hide();
    $("div.PBBranche").hide();
  });

The funny thing is, both examples are exactly the same, the first one hidden link works with the first solution from you and the second one hidden link not.

#917183

Since it's a custom JS codes problem, please provide a test site with the same problem, I need to test and debug the JS codes in a live website, thanks

#920129

I have modified your JS codes as below:

// hide div tags on input
function hide_div_js_func(){
  var myArray= [
	["Branchenspezifisch", "PBBranche"],
	["Kunden-/Marktorientierte Prozesse", "divPBKM"],
	["Kernprozesse", "divPBKP"],
	["Interne Unterstützungsprozesse", "divPBIUP"],
	["Übergreifende Prozesse", "divPBUP"]
  ];
  jQuery.each(myArray, function(index, item){
    var input_value = "input[value='" + item[0] + "']";
    var div_tag = "div." + item[1];
    jQuery(div_tag).hide();
    if(jQuery(input_value).prop("checked") == true){
      	jQuery(div_tag).show();
    }
  });
}

// load the page first time
jQuery(document).ready(function($){
  hide_div_js_func();
});

// AJAX updated result
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ){
  hide_div_js_func();
});

You can test it by this:
Go to URL hidden link
Enable the radio button "Branchenspezifisch", then click the reset button

To setup the JS array myArray, please check the document:
hidden link

#920250

Thanks for your help it worked. Great 🙂

I still have a little problem with the second example hidden link . If you click on the "Weitere Filter" button, additional filters are expanded. If I now click on the reset button "Zurücksetzen", the other filters remain unfolded, can this possibly be hidden?

I was dealing with the Code

jQuery(document).ready(function($)
{
  $(".js-wpv-reset-trigger").click(function(e) {
    $("div#moreFilterGM").hide();
    
  });
});

but it won't work. Could you help me with that? The access data are the same and the link for example (hidden link ) is the same as I sent you yesterday.

Thank you.

#920628

The Views reset button is for resetting the search form, it is not for resetting reset div tags, so it is a custom codes problem, in your case, you just need modify the JS codes you mentioned above as below:

jQuery(document).ready(function($)
{
    $(".js-wpv-reset-trigger").click(function(e) {
      $("div#moreFilter").hide(); 
    });
});

I tested it in your website, it works fine, the only change is the DIV tag, from "moreFilterGM" to "div#moreFilter"

And please create new threads for the new questions, that will help other users to find the answers.

#920767
#920770

Good and quick help. Very good work 🙂 Thank you.