Accueil › Toolset Professional Support › [Résolu] Clicking on checkbox in a filter resets other text inputs
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.
Marqué : Custom search, Toolset Blocks, Views, Views plugin
Documentation connexe :
This topic contains 9 réponses, has 2 voix.
Last updated by Ido Angel Il y a 1 an et 11 mois.
Assigned support staff: Minesh.
Hey,
I'm using this code to filter the checkboxes within a filter:
jQuery("#filterIngredient").on("keyup", function() { var value = jQuery(this).val().toLowerCase(); jQuery(".main-groupbox .form-check").filter(function() { jQuery(this).toggle(jQuery(this).text().toLowerCase().indexOf(value) > -1) }); });
Typing a string filters out the unnecessary filters.
But when I press a filter checkbox, the value of my custom text input resets. Somehow that feels not right. Is this normal behavior? If so - is there a way to keep the custom text input value after the toolset filter custom search is triggered?
You can see here - hidden link - but you'll need to use hebrew letters to filter.
Thanks!
Ido
(click the right yellow square, then you can try typing "אספרסו" in the text input)
OK basically I got this to work by showing results only after clicking submit. but is this how this is supposed to be working?
Correction: it works only when filters' relationship is "AND" - whereas I need "OR". How would I do that?
Hello. Thank you for contacting the Toolset support.
What you mean by the relationship "And" and "OR".
I'm on the following page and I used the characters you asked to use for search as search keyword "אספרסו" - when I add this keyword to search textbox - it shows me three results.
=> hidden link
Can you please clarify where exactly you want to apply "OR" with what result set?
Hey Minesh.
I made a more simplified view for you here:
hidden link
the text filter has nothing to do with toolset, it's a plain text input with jquery filtering function. but you will see that once you check a checkbox below - it resets the text input, if you put anything in it.
thanks
Ido
Toolset supports text search with only submit button that means you can not use AJAX to search with text.
=> https://toolset.com/documentation/user-guides/views/filtering-views-for-a-specific-text-string-search/
In your case, I see you added a text box that allow you to filter results using your custom JS code you added. Views AJAX search do not have any control on what you search using any specific keyword that gives you results using custom JS code.
Basically,this is expected and to integrate your custom JS code with Toolset AJAX request, you will require custom programming which is beyond the scope of our support policy.
Maybe you can check the following AJAX hooks that may help you to trigger the JS for your ajax events:
=> hidden link
If you will require more help with your custom JS code - you can always contact any of our certified partners listed with the following link:
=> https://toolset.com/contractors/
Hey Minesh,
The only thing I expect is the page not to reset when I click a checkbox...
Can this not happen? Does checking a checkbox have to refresh the page (including the search input)?
thx
I understand what you are saying. You should move the search textbox you have added outside the view's search form.
That is within "Search and Pagination" section, move your search text box before the [wpv-filter-start hide="false"] shorcode. Then it should not be get refreshed I believe.
Or
You can even try to move your input search textbox inside"Output Editor" section before "[wpv-filter-meta-html]" shorcode. If none of the above things helps, you may need to use one of the JS even hook I shared with my previous reply.
My issue is resolved now. Thank you!