Populating Drop Down list from API call

Hey everyone!,

I’m trying to create a dynamic drop down list using an API call to get the list of choices for the drop down.

My issue is that I can see the drop down contains the correct number of lines in it (There’s 8 choices in the returned API data and I see 8 lines in the drop down) but the choices have no text in them.

I’m using the Drop Down input element. I’m also using a “Dynamic choices” type, the “Type of Choices” is set to “text” and the choices source is set to the API Call that I’ve configured and to pull the “Name” value from the API call. The name value is configured as a text value in bubble.

I’ve also checked this by adding a repeating group and pulling the API data and get the same result. 8 lines with no text in them.

I’m a bubble noob but I’ve gotten through the tutorials OK and think that it could be an API call issue but I just can’t see it!

Anyone that wants to help and would like to take a look at the app just let me know :slight_smile:

1 Like

Yeah, definitely sounds like an API issue based on my experience.

Could you post a link to your editor so that the community can look through it and see if anyone can spot the problem?

Or, if you don’t want to share your editor, could you create the same thing in the forum app so that people can look at it there?

Hi,

This is the URL to the app: https://bubble.io/page?id=ozswapntrade&tab=tabs-1 which I’ve made read-only. Let me know if you can’t get into it :slight_smile:

You will find the API call called “Get-Locations-API”. I’ve read further and I think that maybe the API is not returning a simple list. The RAW code is in a nested format so I’ve also tried to alleviate my issue by using a SQL query to return a simple list of just the text that I need in the drop down however I don’t seem to be able to use that data in the drop down either!

The SQL query is called “Get States” and returns 1 field called “name” which is defined as text in Bubble.

Hoping you can help me!!

Cheers from the Noob!

Which dropdown? Is it …and a suburb?

Note - one error with “…and a suburb” is that for the data source, you didn’t specify which API. You’ll notice that the text is red which means it’s not valid.

Welcome @wayne.bennett , looks like you’re having fun!

Your API definition looks fine. I was able to get the state name from the API into a dropdown, and a repeating group (with a text element). (I hope the api key wasn’t confidential! Edit: it works without authorisation)

Hi Mishav,

Thank You!! As you said I also though the API call was fine. I was missing the “Current option” parameter in the “option caption” field. :slight_smile:

THanks so much for clearing that up for me. You’re a legend!!

1 Like