Skip Navigation

[Resolved] Conditional Output for custom search is not working

This thread is resolved. Here is a description of the problem and solution.

Problem: I have conditional HTML in place in a custom search View's filter area, but it doesn't seem to be working as expected.

Solution: Conditional HTML is designed to respond to the properties of posts, not selected search filters. Using conditional HTML to respond to selected filters is not going to work consistently, even if you find certain edge cases where it appears to be working briefly. If you'd like to see more filter dependency features built into the system, I encourage you to submit your request here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

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

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 8 replies, has 2 voices.

Last updated by FelipeP5703 5 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1231141

I am trying to: please watch this video I recorded: hidden link

Link to a page where the issue can be seen: hidden link

I expected to see: Expected the coditional output to work as the article showed

Instead, I got: not working

#1231156

Hi, Toolset's conditional HTML feature isn't designed to respond to the filters selected in a View. It's designed to respond to the properties of some post, like the current post or the current post in a loop. What you're trying to accomplish is a filter display dependency. Unfortunately there's nothing built in to Toolset that does specifically what you're looking for. One thing we do offer is the ability to only show available options for each input. We have more information about this here: https://toolset.com/documentation/user-guides/front-page-filters/advanced-settings-custom-search/

So if none of your posts have a value for Rua Centra RJ AND have the value "Centro" selected for Bairro RJ, then the Rua Centra RJ field will be hidden or disabled since there are no matching results.

Another option is to use your own custom JavaScript to show or hide the input field manually. We do not have a JavaScript API for filter interactions, but we do provide some event handlers you can use to respond to specific search and pagination events. In the View editor, find the Search and Pagination panel and open the JS editor panel just below it. Then click "Frontend Events" button to create your own event hooks. They can fire when pagination is complete, or when the search filters are updated, or when the search results are updated, for example.

#1231220

I recorded: hidden link

Unfortunately there's nothing built in to Toolset that does specifically what you're looking for.
why does the conditional output work now?

#1231222

why does the conditional output work now?
I can't say for sure. You might find certain cases where it does seem to work, but then stops working unexpectedly. Other cases might not work at all, and it won't be obvious why. My recommendation is to avoid using conditional HTML in the filter area.

#1231234

Shouldn't you ask the programmers why this happens? Shouldn't they fix it, so it's not buggy?

Also this happened: hidden link

#1231714

The developers will not address issues that arise from misuse of the system. This is a misuse of conditional HTML, and it's not going to work like you expect it to work in any consistent manner.

#1231793
conditional output.jpg

So what is the correct usage of this conditional output function on Search and Pagination? There is a button there, so I am assuming it is used for something, right? I would like to know how to use it please.

#1231873

Don't use it. This is what I'm trying to tell you. It's buggy and you shouldn't use it for ANY reason.

#1232852

My issue is resolved now. Thank you!