Add radius search to results view

By: Fain Fain | Asked: 10/08/2022
ForumsCategory: General questionsAdd radius search to results view
Fain Fain asked 2 years ago
I've created a job board. I've got a Formidable Form that the frontend user fills out. This gets fed to a live page that hosts a View. User can select Details and see a Details page with more info. It works great. The only problem is, this job board is not just local. I can add a Search Bar that Formidable Forms provides, but it's just a keyword search. So someone could search for Atlanta, but it wouldn't get a job in the suburbs, like Dacula. It would also get any company with the world Atlanta in the title or description. What would be ideal is to have a zip + radius search. My form requires a zip code entry already. I asked Formidable Forms customer service and they said they have nothing like that and that I should ask in this forum.   I've checked out Geo My WP, but you have to make every form submission into a Custom Post Type, which then means that you cannot use Formidable Form Views at all (as I understand it). I'm looking for something that could plug in to the View page and narrow the view exactly like the Search Bar does, but based on location.   Thanks!
2 Answers
Victor Font answered 2 years ago
The best option for a radius search is to integrate Google's maps API. See
Fain Fain replied 2 years ago

Thanks. I have the API already. It integrates with Formidable and lets users put in their address on the form.
However, I'm unaware of how to use the API to make the results of the Form searchable by the end user in a Formidable View.

Elizabeth Martinez answered 1 year ago
Have you figured out how to do this? I need a similar search - but for business listings so I'm curious to know if you were able to accomplish it and how.
Asheley Bailey replied 1 year ago

Unfortunately this wouldn't be a one size fits all but this should be helpful:

This could be fairly simple for you if the businesses are listed in Google's API.

If they are, this is how I would do it. **This only works if the business' name in your view listing are formatted the same as Google's API.** I'm doing something similar with Address' and have forced users to pick an address from Google's Autocomplete to ensure everything is formatted consistently and I don't end up with duplicates. I'm using this to create posts but you can do the same to create formidable entries. It requires wrapping an input with the API. It would then create a drop down below the input that adjusts as they type. You will want to add an input event listener that will force selection from the drop down and not accept typed in entries. All of this can be added to the Custom HTML area in the formidable form Settings page for the form that builds your listing.

For the search:
You will want to create inputs for the required google parameters which you want your users to be able to adjust. Anything else can be a static parameter.

You will use this to call the API.

You will then create a view filter which compares the API response with your entries and only displays the ones found in both. I would compare the name response attribute to your business names.

This may not be exactly perfect based on how your setup but hopefully it points you in the correct direction.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community