Forum Academy Marketplace Showcase Pricing Features

Add new fields... how to do?


I have a kind of field which is composed of 2 things : each value has to be chosen inside a select.

The user will then choose first value from 1st select and second value from 2nd select.

But then he has to be able to add new values, which means new “pairs”.

I need to display a “Add new values” button, and each time the user clicks on it, he must have a new line with the 2 selects.

I’m not sure how I can do that… I was thinking of repeating groups but I’m completely newbie with Bubble and don’t know how to do that…

Could you please help me ?

Thanks a lot !

1 Like

I think watching some videos on database design would help - look for posts by @cmarchan - he often has some good lists of links for understanding DB design.

Once you understand how to store this in the DB - it will become clear how it works on the UI.

1 Like

DB design is not an issue. I’m a developer, I know how I would do it in PHP / jQuery.
But i have no clue how to do it with Bubble.
I don’t know how DB design can help me figure it out…

I’m sure you’ll figure it out then :wink: that Bubble is a DB based application for persistent storage and custom states for temporary storage. And you can put conditionals to test those states pretty much everywhere.

Sorry I didn’t mean to under-estimate your skills and experience! It really helps to be a developer sometimes with Bubble, but you have to figure out the Bubble way of doing things.

No Lindsay, don’t worry, it’s ok :slight_smile: I didn’t mean to be rude.
What I mean is : my issue is not related to how i will store the data.
But how i can handle this “add new pair” button.

When the user clicks on it, it has to display 2 selects, each time.
This is this fact of displaying each time these 2 selects that is not pretty clear for me.

But I think I will put the selects inside a group, with a delete button too.
This group will be hidden on page load.
Then when the user clicks on “add new values”, it gets visible and I have to display another “add new field” link (and another hidden group), and so on.

I will try to do it with repeating group. Still don’t know how but this “looping aspect” makes me think RG is the way to do it…

Sorry if I wasn’t clear enough - I’m french :slight_smile: not always easy to explain what i want to achieve and what the issue is :slight_smile:

:+1: What about having an “on change” workflow of a dropdown of “select1” & “select2” - and a conditional “If pair of select1 & select2 dropdown values doesn’t exist in DB - create this new pair”.

If not dropdowns - on click of things in RepeatingGroup1 and RepeatingGroup2 - set some custom states of “last click choices” and then check if those pairs exist in the DB and add if not exists.

That’s kind of what I mean by conditionals and the DB and custom states. Custom states are your “variables” in Bubble and Conditionals are your “code”.

Bonne chance :slight_smile:

1 Like

Merci !

I created a repeating group.
I added a group inside with my 2 dropdowns.
The dropdown content is based on the database.
But when i display the page, there’s nothing displayed in the RG.
This IS my issue (for now).
I don’t have any problem with data storage because for now, no data is shown at all !! :slight_smile:

My problem is : how to display this “add new” button that will display the 2 dropdowns.
And each time it’s clicked, 2 new dropdowns appear.
You see what I mean ? I don’t know how to do that in Bubble because my repeating group remains empty…

What is the datasource for the RG? Are there any privacy rules? Sounds like the datasource of your RG is empty?

yes, the data source is empty because i don’t know what to put in it :slight_smile:
From my point of view, what will be repeated ? 2 dropdowns.
So what should be the source ? I don’t know.

Each dropdown has its source and displays ok (I know it because I moved them out of the repeating group and they’re both fine).

Now I must admit i don’t know what to do. Something which is quite simple to do with standard languages is turning into a nightmare (for me). I guess it has to be doable, but how ? Do you have any idea ?

A RG displays a list of Things in cells. If that list is empty then it will display zero Things, or display zero cells, however you want think about it. That is why your RG displays nothing. If your RG had a list that wasn’t empty as it’s datasource it would display some cells and the contents of those cells.

This explains it better than I can.

Maybe this will help.

let myList = [];

for (const x of myList) {
console.log("It doesn’t matter what I put in here it will never print. " + x);

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