Forum Academy Marketplace Showcase Pricing Features

Format geographic address to ONLY show City, State

Need help only showing the City, State when someone enters their full address.

Scenario:

When a user signs up they will be asked to enter their address. The full address should never be shown to other users (per requirements of my app).

I only want to display City and State to other users. Anyway to format this using the full address?

3 Likes

Hi @spotyourlocal, did you ever find a solution to this?

@louisadekoya, just retrieve those address components from the geographic address and store them in your own fields. The geo address data type has many :operators (or perhaps you might call them subfields) that represent the components of the address. Play around with those in a text element to understand what is available to you (or consult Google geocoding API docs, perhaps).

Basically, when a user enters or updates their geographic address, you can decompose the parts you want and save them on some object, be it the user or your own address data type. In this way, you can avoid making tons of API calls to get :city and :state or :state_code (or whatever it’s called) at runtime. When you reference these operators on a geo address, you are actually consuming Google geocoding API calls, which is not always desirable.

Thanks for the suggestion, @keith. To be clear, what I want is that as a user searches for their address to enter it, the list of matching addresses only includes city and state. As I won’t have a list of all states and cities in my database, I believe I do have to use the Places API, unless I’ve misunderstood your suggestion.

Since posting this question, I have found the following https://forum.bubble.io/t/geographic-location-search-limitations/22299/6

I’m going to give this a go.

I’m just going to humbly suggest that this is a silly interface. It’s much easier for the user to just give you their address.

Here’s THE way to get addresses in Bubble, regardless of what you eventually store:

1 Like

@louisadekoya Did you ever get this to work? I have a survey/quiz and am looking to have the user enter their city as well. I feel like it is too much to ask them for their actual address outright at this stage and capturing only a State would be limiting.

1 Like

Hi, anybody found how to do this? I just want to display the City, not even the State

hello did you find answer to it yes?

Enable users to input their address either at sign up or to edit on their profile page >
Add a text element to your group >
Insert dynamic data >
Select "Current Page User’s Address >
More >
Extract: >
Then select City >
Repeat from insert dynamic data >
Select state