Skip Navigation

[Resolved] Clicking on checkbox in a filter resets other text inputs

This support ticket is created 4 years, 3 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.

Our next available supporter will start replying to tickets in about 2.73 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 9 replies, has 2 voices.

Last updated by Ido Angel 4 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#1741051

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

#1741053

(click the right yellow square, then you can try typing "אספרסו" in the text input)

#1741161

OK basically I got this to work by showing results only after clicking submit. but is this how this is supposed to be working?

#1741295

Correction: it works only when filters' relationship is "AND" - whereas I need "OR". How would I do that?

#1741723

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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?

#1741733

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

#1741769

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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/

#1741777

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

#1741821

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1741823

My issue is resolved now. Thank you!