Displaying a single search result based on a Drop Down List

Hi Everyone,

I am new to Bubble. I have created a data type “Fruit”. It has two fields: FruitType and FruitColor. I then entered the following records:

FruitType FruitColor
======== ========
Apple Red
Banana Yellow
Orange Orange

I have created a dynamic dropdown list that now contains the “FruitTypes” in it as choices. The choices are Apple, Orange and Banana.

I am trying to get Bubble to to search my Fruit data based on what is selected in the dropdown list and display the color.

If the user selects Apple in the dropdown, I want to use that value to search my Fruit data and then return Red to display in a text field.

This feels like it should be super easy to do but it is hard to find out how to do this. Can someone please help?

Thanks!

Hi ellegro,

welcome to Bubble.

  1. Create a repeating group
  2. As type of contentmake it fruit; as data source do a search for fruits. As constraint: fruittype= dropdowns value
  3. In the repeating group add a text field with dynamic content: Current cells fruit’s fruit color.

it should look like this

hope this works, pm me if you need further helps
happy bubbling,
Julius

Hi Julius

Thanks for the quick response. I must be doing something wrong as I am getting an “issue” that says “Dynamic data in text boxes must be printable as text but instead this is a Fruit.” Can you please help troubleshoot further?

Here is my dynamic drop down that I set up:

Here is the Repeating Group I set up as per your guidance:

Here is the repeating group with the text box to display the color:

Let me know if you have suggestions to fix this.

Thanks!

Hi ellegro,

thanks for your detailed information provided. Everything is correct except for one thing:

You created a data type fruit, which has 2 fields: fruit type and fruit colour, both text.

Your repeating group has fruits, and as constraints that the fruit type= X, X must be a text as fruit types are texts, not fruits.
The dropdown that decides X however is selecting fruits, not fruit types.
This leads to a mismatch of data types.
That your option caption is current optionsfruit type, doesnt change this, this is just what is displayed.

To change this make the source for the dropdown: Search for fruits ’ fruit types with text as the type of choices.

Hi Julius

Thanks for your help today! I got the fruit example working. I also applied the concept to an example with numeric values. I have a Data Type called RaffleTickets with 2 fields: TicketQuantity and TicketQuantity price. For example, it will keep track of the fact that 3 Raffle Tickets will cost $20, 8 Raffle Tickets will cost $40 and 15 tickets will cost $60. I was able to do everything that I did with the Fruit example with the Raffle Tickets. If someone selects that they want 3 tickets, the repeating group shows $20. Now I want to build on this example further…

I have a section on my page that asks someone how many admission/event tickets they want and also a section where I ask how many raffle tickets they want. I am trying to ultimately build an order form. Using the Raffle ticket example where someone selects that they want 3 tickets from a drop down menu and the repeating group shows $20, is there a way to then use the $20 as a variable or numeric value? If not as part of the repeating group, can I convert it somehow? Is there where I have to create a custom state?

I would like to create an order form sub-total where SubTotal = AdmissionTicketCost + RaffleTicketCost

I can get the AdmissionTicketCost to work in a formula but not the RaffleTicketCost yet as I feel like I can’t do that while it is a value in a repeating group.

Any suggestions?

Thanks!

This topic was automatically closed after 70 days. New replies are no longer allowed.