Hello all the team,
I am looking to display results based on two search fields.
I activated the AJAX refresh when changing a filter as well as the option to display only the options that produce a result.
If the user selects an option from search field 1, search field 2 adjusts automatically thanks to the option "only display options that produce a result". So far so good.
1. The problem is that if I then select an option in my search field 2, all the other options in that field disappear. I would like them to remain visible in order to switch between them.
2. Second problem, I would like any option change in my search field 1 reset search field 2. Any idea how to do that?
3. I would like no results to be displayed until search fields 1 and 2 contain a value.
Process summary example (with image):
- User selects value 1 from search field 1, automatically, search field 2 displays values A, B and C (because these are the only combined values that produce a result).
- The user then selects the value C of search field 2: The loop view returns post 3.
- If the user changes the value of search field 1, search field 2 is reset automatically.
Thank you in advance for your help !
Hello,
Thanks for the details, the problem is that there isn't "All" options in both search field.
Please try these:
Edit the view block you mentioned above, find and select "custom_field_1" and "custom_field_2", in the right sidebar, option "Dropdown Placeholder", fill some test, for example: All.
See screenshot all.JPG
Then test again.
Hello Luo Yang,
Thank you for your reply !
I created the Placeholder but that doesn't change the problem.
In my example, if I put the value 1 in search field 1, search field 2 displays the values A, B, C, and All dynamically.
If I then select option A, my search field 2 only displays A and All but B and C have disappeared. I would like to keep the 4 possible options with the value 1 of the search field 1 (A, B, C and All).
I have tried it in my localhost in a fresh WP installation, it works fine:
if I put the value 1 in search field 1, search field 2 displays the values A, B, C, and All dynamically.
See my screenshot select-2.JPG
Please check these in your website:
1) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020
2) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/
3) If the problem still persists, please provide database dump file(ZIP file) of your website, you can put the package files in your own google drive disk, share the link only, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/
Since you are using option "Show only filter options that would produce results", so it will hide those options without any result, and it is expected result:
My problem is that when I select an option in dropdown 2, all the other options of this dropdown disappear.
In your case, you will need to disable option "Show only filter options that would produce results", then test again.
According to our support policy, we can not provide such kind of custom codes:
https://toolset.com/toolset-support-policy/
You might consider to check it with our Toolset contractors:
https://toolset.com/contractors/
There is something that I do not understand. Why do the options for my search box 2 disappear while the options for my search box 1 remain in place (I can still select the other values of the field while none of them returns a result)?
I may have trouble explaining myself, I would have to explain this to you on video but we can only upload images...
For my second question, I have already looked at some tracks on other topics like this: https://toolset.com/forums/topic/search-sub-filters/
In jQuery, do you think it is possible to reset search field 2 (set on the value of placeholder) when the user changes value in search field 1?
Something like :
jQuery(document).ready(function($){
$('#wpv_control_select_customfield1').change(function() {
$('#wpv_control_select_customfield2]').val("Placeholder value");
});
});
Thanks for the details, I can duplicate the same problem in my localhost, and have escalated it, will update here if there is anynews.
The JS codes you mentioned above won't work in this case.
Currently, you can try to create a view with classic editor, for example:
1) Dashboard-> Toolset-> Settings-> General
in section "Editing experience", enable option "Show both the legacy and Blocks interface and let me choose which to use for each item I build"
2) Dashboard-> Toolset-> Views, create a new view, setup the custom search form
in section “Custom Search Settings”, enable option:
- Let me choose individual settings manually
- Update the View results every time an input changes
- Show only available options for each input
3) Edit page again, add a Toolset View block-> Use existing View, choose above view, then test again.
Hello Luo Yang,
I tried to follow your directions but the problem is the same.
It does not matter, I will find another solution!
Thank you
Hello,
This is fixed in latest Toolset Blocks plugin, you can download it here:
https://toolset.com/account/downloads