Displaying second repeating group after selecting specific option in first repeating group

Hi, I’m in need of help… Relatively new to Bubble, I’m creating a pop-up with a repeating group (the “Allergens”). Now I want the second repeating group (highlighted in red) only to be visible when the value “Gluten” is checked.

The allergen data is app data and not an option set.

Your help is appreciated on how to fix this.

Have a nice evening,
Jelle

Welcome @jellelissens to Bubble!

Create a state on your initial repeating group called “selected allergens”.

State: A list of “allergens”

Now create a trigger when a value has been changed for the checkboxes.

Inside that trigger, make it so it adds the item to the list if It’s not there, or removes the item from the list if it is there.

I haven’t been on Bubble in a little bit but there may be additional logic to make the lists work. If you’re not able to modify the list, you can ideally set list each time a value has changed with all the values of the selected options. I can try to make an example later for you if you cannot figure this part out.

You should now be able to refer to the allergen repeating group’s state with conditionals.

Hi @GH5T thanks for the reply.

I was already able to create the state, since I’m needing it as well to store the data in a later stage.
My biggest question mark is how do I refer to the “gluten” in the conditionals to activate/make visible the second repeating group? Multiple checkboxes might be highlighted, but only when gluten specifically is highlighted, the second RG should be visible.

Does it make any sense what I’m saying/asking?

I should have answered that for you. You can refer to the state of the Allergen repeating group that you set.

Make sure it’s the repeating group itself you set the state on.

If done correctly, your entire page should be able to see that particular repeating group’s state.

That’s how you’ll get the conditionals for the ingredients to show up the way you want.

For specific targeting, you would use ... contains ... value

@GH5T

I have created the state on the first repeating group, I’m now going to the second RG’s conditionals, i’m referring to the state but then what… ?

Really sorry, feeling so stupid…

You’re close!

Now use contains ''your option set'' 's values.

Depending on your setup, there may need to be some changes to make this work the way you want. But I will try and help you get somewhere close. I have a reusable element somewhere that allows you to do this, and you can refer to each item that is selected. I’ll find that if you cannot figure this out this weekend.

@GH5T that’s the thing… The data are not option sets. It’s app data. Should I be working with Option sets?

Either or works! :slight_smile:

You just have to build with “dynamic” names/items in mind.