Skip Navigation

[Resolved] Trigger search filters from an external source.

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

Problem:
Trigger search filters from an external source.

Solution:
To trigger the search filter obviously you will require to add the custom JavaScript code that should trigger the change event of the country dropdown.

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/trigger-search-filters-from-an-external-source/#post-2037713

Relevant Documentation:

This support ticket is created 3 years, 6 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
- 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 3 replies, has 3 voices.

Last updated by Stephen Vaughan 3 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2037533
Screenshot 2021-04-30 at 09.37.17.png
Screenshot 2021-04-30 at 09.37.02.png
Screenshot 2021-04-30 at 09.36.43.png

Tell us what you are trying to do?

I have a map set up using the Interactive Geo Maps plugin. With this you can hover over each region on the map and it will trigger an action. As you can see in my screenshots I have the Action Content field set up to go a specific page, but, what if I could set a trigger to change the County filter in a view to narrow down the listings to just that county. Is there any toolset method to do this, before I go off to what I presume will be a javascript solution?

#2037701

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

To trigger the search filter obviously you will require to add the custom JavaScript code that should trigger the change event of the country dropdown.

Do you mean you want to prefilter the view result with specific country? If yes, again on document ready event you should add add a JS code to change the option of country dropdown.

#2037713

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Stephen

You will need a JS solution, yes.

You'll react to the event triggered by clicking on the map, and then update the option for the county filter with JS.

If you are using the setting that the View results should update whenever a filter value changes then you need to be aware that this responds to the change event on the filter, but when you programmatically update the selected option the change event is not triggered, and you'll need to do that yourself.

Something like

jQuery("select[name='wpv-county']").val("clare").change();
#2037715

Thanks again Nigel. That gives me something to work with.