Dynamically create/add an element

Hi!
Is there a way to dynamically create an element - I mean not just show/hide it? For instance, in order to display an unanticipated number of shapes or inputs based on a user input?
Thanks for your help :smiley:

1 Like

Create a dB data type call it “element”
Build an rg with the element you want inside an rg row group that you will use to establish conditions
Set the content to “element” and the data source to a search for elements
You need a trigger. For this example let’s add a button outside of the rg. Set it to create a dB element upon being clicked.

The above is super basic I know, but hopefully it sparks some ideas. :+1:t2:

2 Likes

Thanks for the idea! I already tried something like that but I’m lost when trying to configure the size and positioning of the RG. Especially since, in an ideal world, I would have loved to have different element sizes and positions in each “square”. I was thinking maybe there’s a way to “call” a Bubble element using a (simple) javascript?

I’ve done something similar in the past, this app can automatically generate a population visualization using bubble.
Each time you add population it shows a dynamic shape based on the number of population added to each area of the map.
Try it yourself: https://wrld897235-34.bubbleapps.io/version-test
And then check the editor: https://bubble.io/page?name=index&id=wrld897235-34&tab=tabs-1

It’s not a nice solution but everything is possible with bubble.

There is even a time-lapse feature that shows how the population has evolved overtime.

Interesting indeed (and well done!) but, if I’m not mistaking, this is still dynamic show/hide where you have to anticipate in the condition tab all possible outcomes on the page? In the case of the app I’ve got in mind, that would mean the programming of tens if not hundreds of situations - way too fastidious to build and maintain error-free… But thanks for the inspiration!

1 Like

Using repeating groups and underlying data you aren’t hiding and showing it.
So basically if you want a dynamic amount of inputs then you build a repeating group with a single piece of input.
Then you create a data type called “Inputs” and then you create a button that will create a new “Input” data and then the repeating group will show a new input field every time you click the button. This is pretty dynamic imo.

1 Like

You’re right and I can see how it works fine in order to display an expanding view of identical elements like your green dots. But that’s not exactly what I want. And if it’s not possible to make the app create an element on the fly (something like “build X shapes/textboxes/inputs of these sizes and put them at these coordinates”), that means I probably have to rethink my project and find a more practical logic to anticipate the user input… :thinking:

There is a plugin to move elements to any coordinates but you’d likely have to create the shapes and inputs manually.

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