Number of rows in repeating group to reflect number in input textbox

Hello dear community! I am trying to create a pop-up for data input, where users can list ‘number of passengers’. The value of this input should be between 1 and the maximum number of ‘available seats’ (all stored under one dedicated data type).

I then display a repeating group, where the user should input passenger data for each passenger specified. How do I set the number of rows in the repeating group to dynamically reflect the number of passengers in the input textbox?

What would be the best way of storing data for multiple passengers (I expect the number of passengers to range from 1-6, and need to store three data points for each passenger).

Hey @edb27 :wave:

There is this useful post about what you want to do: Dynamic row addition in Repeating Group and bulk CRUD of Things using vanilla Bubble - #3 by DjackLowCode

But in your case, I may suggest another simpler way. Instead of asking for the number of passengers just like that. Show an Add passenger button. With the button press, add a passenger to the database with empty fields, and let the user fill these and they can add another passenger if they want.

See the demo below:
brave_0bLhlc1KaG

Simply, the button creates a passenger immediately:
image

Then, the repeating group shows all the passengers in the system (or in your trip?):

You can disable adding new passenger if the empty one is not filled yet for example:
brave_C7gWLBRyBW

Here is the editor if you want to see the details: Bubble Demos by Flusk | Bubble Editor

Of course, the empty passenger will remain in the DB if your user closes the page, you can clean the db time to time.

I hope this gives you some idea to start.

bdk_512x512 @Huseyin from Flusk | Discover the #1 Security and Monitoring Tool for Bubble

1 Like

Hiya, thanks for sharing and for the great demos! :slight_smile:

1 Like

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