Forums Forums Search & Filter Pro Clear search input only

Viewing 10 posts - 1 through 10 (of 12 total)
  • Anonymous
    #219835

    Hi
    I’m using S&F Pro for category multi-select filters, together with a search box.
    The reset button will reset all filters of the form.

    Can you please assist with a solution to clear/reset the search input only, leaving the categories filters as they are ?

    Thanks.
    Doron

    Trevor
    #219850

    That is not possible with our Reset button, so you would need to create a custom button on the page (maybe just below the form) that calls some custom JavaScript to do as you want.

    Anonymous
    #219865

    Thanks Trevor

    I actually tried to do so, created a button with a click function for:

    $('.sf-field-search input').attr('value','');
    

    $(‘.sf-field-search input div’).remove();

    But it didn’t work well with the ajax call.
    The filters currently use ajax with auto-submit.
    I also tried to include the function on ajax start, but no luck.

    Can you please be more specific about how can i combine this correctly with the ajax functionality ?

    Thanks.

    Trevor
    #219873

    Did you add a call to submit the form after making that value change?

    Anonymous
    #219881

    I did try adding the type=submit to the button, it didn’t seem to work well.
    Can i somehow submit the form using Jquery after clearing the input ?

    Thanks.

    Trevor
    #219889

    Sure. Something like this?

    jQuery("#search-filter-form-53").submit()

    Change the ID number in that code of course!

    Anonymous
    #219897

    Thanks.

    The issue is that for some reason it doesn’t work the first time, just after page refresh (the page loads as it should according to the url containing the filters and the search) then it works.

    I did this:

    $('.sf-field-search input').attr('value','').empty();
    

    $(“#search-filter-form-37”).submit();

    Why it only works after refresh ? do i need some kind of callback to execute the submit after the clear is done ?

    Thanks.

    Trevor
    #219903

    I had to check back a way to see what our plugin developer said when I last asked this question, and the way he reset the value was different, see here:

    https://support.searchandfilter.com/forums/topic/how-to-style-the-search-data/page/3/#post-43980

    Anonymous
    #219909

    Awesome !
    Thanks a lot.

    Trevor
    #219911

    Let me know how you get on?

Viewing 10 posts - 1 through 10 (of 12 total)