Skip Navigation

[Résolu] Trigger search filters from an external source.

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 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.

This topic contains 3 réponses, has 3 voix.

Last updated by Stephen Vaughan Il y a 2 mois et 4 semaines.

Assigned support staff: Minesh.

Auteur
Publications
#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: Anglais (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: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01: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.