Forum Academy Marketplace Showcase Pricing Features

Both an Input & Geographic SearchBox Possible?

I’m trying to achieve this. Where the “Deliver to” input functions as both a text input and a autocomplete geographic search.

When you type in the address it tries to autocomplete (via Google Places API) but if you don’t select a google place, then it would just keep the text and use the text as a normal input.

Hey @brad.h ,

Thanks for reaching out and great question!

As with most things in Bubble, there’s probably a couple different ways you could do this. But, the simplest would be to use our searchbox, set to autocomplete geographic places to enable this functionality. You would also use a series of inputs set to the ‘SearchBox’s value:extract x’ where x is the city / state / zip for the corresponding address. The benefit here is that those inputs will get filled automatically if an address is selected, and can still be typed in if one isn’t.

Here’s a link to a quick demo of this approach: https://demoderby.bubbleapps.io/version-test/scratchpad?debug_mode=true

And of course, if you have any additional questions, don’t hesitate to reach out to [email protected] and we’d be happy to help!

1 Like

@AndrewV thanks for the reply! If I type text into the SearchBox without selecting an address, could I pass the text from the search box to another group or workflow to create a thing (aka could I make it work like an input)?

Example:

I typed “AndrerV Street” into the search box. It’s not a real street so I obviously did not select it from the Google Places API dropdown. It’s just typed text. So no address is selected.

Then I added a city, street, etc by typing text.

Would it be possible to create a new thing like this:

Street Address is SearchBox A's Typed Text

Sure thing @brad.h - Although I owe you an apology. I converted another demo I had made and didn’t test to see if ‘typed text’ was still available just assumed it would be. Sorry about that.

This can still be built how you’re describing, but it’ll take a little more effort to pull it off without the typed text. (I’ve asked internally why this isn’t available with geographic places but is available with other search box modes). What you’d want to do is either grab a plugin that offers access to the Google maps api, or create an API connector call yourself.

You could use an input box for the user to type in an address and have a repeating group in a group focus that appears to mimic the look and feel of the search box. The repeating group would be polling the google api for geographic places that match the input’s value. If one is clicked, you could store the value in a custom state, display the state’s street address in the input and display the other values in their corresponding inputs. If nothing is clicked, you would still have your input with it’s value.

Would definitely be easier with ‘typed text’ but this solution would give you a way to pull it off as well! Feel free to reach out with any questions to [email protected]

I’ll try this out and report back. thanks so much!