Dynamic Row Addition in Form

Hello. :sunny:

I have a form where I want the user to be able to add 6 similar rows underneath each other.

Is it possible to place the input fields inside a “Repeating Group (RG)” and somehow trigger a new line by pressing a button, while also allowing the removal of a line if there are too many “Add more” clicks?

I’m using an external database, so inline editing in a table won’t work.

Thanks in advance!

Sure… there are two ways you can do it…

Create a new row in your external database whenever the Add More button is clicked

or use some arbitrary list (such as a list of numbers) for your RG, then only create the rows in your external database upon some other action.

The last option suits me.

How do I proceed?

in that case it’s simple…

Just use a custom state list of numbers, and set the RG datasource to that list.

Any time the Add More button is clicked, just add a number to the custom state list to create a new row in the RG.

You can do the same (or rather the opposite) to remove items (either automatically or on click of, for example, a trash icon) from the RG.

Extracting the values of the inputs is a little more tricky, but some simple JavaScript will be able to to that…

Then you can do what you want with the values.

Here’s a simple example: Add Items To RG (bubbleapps.io)

3 Likes

Wow. Nice! :sunny:

How do I retrieve the values in the rows and send them in to the database, do I just refer to the input values as usual? Note! I have an external database if it is relevant.

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