How to create arbitrary # of elements form?

I want a button so that when clicked, it creates a new dropdown input element. And this button can be clicked infinite times. So there could be 11 dropdowns on a page.

Then…I need to be able to easily save the values from all of the dropdowns.
What is an elegant way to accomplish this? Thank you!

What are you actually trying to accomplish with this, maybe there is a better way to do what you are looking for?

im simulating a game. In game, there are an arbitrary number of enemies that may be in fight, and I want x dropdowns for x enemies.

Hi there, @heyletsdimdim… I’m guessing you didn’t mean to mark your last response as the solution to your post, right?

As @troy.roberge pointed out, you really didn’t give us much to go on to try to help you out here. Some questions that immediately come to my mind… how do you define an enemy? Are there different kinds of enemies? What are the options in the dropdown and how do they relate to an enemy?

My questions aside, your post seemed interesting to me, so I played around with a simple idea. If the enemies are predefined in a table, you could “serve them up” in a repeating group, and you could use a dropdown to decide how many enemies to show. So, it would be something as simple as…


… and when a number is chosen, you show that many enemies in the repeating group…


The options in the enemy dropdowns could be controlled by an option set, and you could have a button to make changes to each enemy.

Again, because you didn’t give us much to go on, this idea might not have any relevance at all to what you are trying to accomplish. But, if the idea does have merit and you need any help getting down this path, I would be happy to provide the details.


1 Like

This sounds great! I made a repeating group and put a dropdown in it…however the dropdowns disapear when I preview. any idea why? Thank you! Bubble|App without code

the RG will only show if you have a record for whatever the content type is… So you might be missing a workflow to create the # of records you want to display.

You can also have a button which creates a new element (as a thing) in database when clicked, and repeating group displays a dropdown.

Like this:

Hey there @heyletsdimdim… I’m happy to hear you like the sound of the idea I proposed! As others have already pointed out, getting down this path is not just as simple as putting a repeating group on a page. A repeating group has to get the data it displays from somewhere, and that’s why the word “predefined” in my initial response (i.e., If the enemies are predefined in a table…) is the key.

The idea is based on the fact that you have a data type that already has the enemies in it. How you get the records into that data type is up to you, but for the purposes of my example, I manually created the records n my Enemy data type. So, that table itself looks like this…

Once you have the Enemy data type and it has some records in it, your repeating group would have a set up that is something along the lines of the following…

Hopefully these details have made the idea a bit clearer and they can help you make progress down this path.


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