Hey all,
I just started to work in Bubble and took the tutorials but I am still having a hard time with a concept that I would think is easy.
I have a list of locations, let’s say ice cream stores and I want the user to input an address and based on this dynamic information the various ice cream stores within X miles will appear. For some reason, I cannot figure out how to do this.
I created an input box and a button that says submit. I also created another page which has a map on it. I can get the map to display my locations but I don’t see a way to limit it to within X miles. Plus, in other map features, there is a pin where their location is, but I cant get this to work.
Also, with the above approach, won’t I overload my database with user locations? Is this the best way to set up the search function?
You can make the research by using search conditionals, if you are working with a geographic elements, the option display by miles will appear and with dynamic values you will be able to put the value desired
Also about the pin in the center, its a simple trick. You just have to put an icon in the exact center of the map, and when selecting in the map a location, use the option “center of the map” (or something like that, I don’t fully remember).
Here we’re just telling Bubble to first create a new Store (using the Data → Create a New Thing Action, with the Thing being a Store), and saving the Name Input’s value to the Name field, and the Searchbox Address’s value to the Address field. Once that is saved, we reset the inputs where the User just typed in the new Store’s information. If we had a store called “Sally’s Ice Cream” in New York City, it could look like this:
You can also use an input to make the “within X miles” dynamic as well. So if you wanted to allow the User to enter “5” for the radius, the constraint expression would be: “Address is within [Input Miles] miles of [Searchbox Location’s value]”. And that should do it! Feel free to let me know if you have any questions or need any help in setting this up