How to add an 'Add New' button which adds a new row of inputs

Hi,

What’s the best way of being able to add a new set of Input Fields? I don’t want to commit the changes to the data model until the user clicks ‘SAVE’.

GIF below shows what I mean.

Nov-28-2020 16-36-20

Create a Repeating group that has a data type of numbers. Use the list item expression to create a list of numbers.

Set it up so the number of items in the list of numbers is dynamic which would reference a custom state which is a single number value.

If you want to start with zero items, set your custom state to 0 default, if you want to start with 1 item set default to 1.

Then when you have the add new button clicked, increment the custom state value by 1, which in turn will increase the length of the list of numbers by 1 which in turn will add a new row to your repeating group.

Your repeating group should be set to 1 row 1 column at full list.

4 Likes

@boston85719 @J805 - Sorry, how do I do the List Item Expression piece?

Did you install the plugin and add a list item expression element to your page?

1 Like

You might want to check out the following thread which describes a few approaches (some not requiring a plug-in)…

@boston85719- So, the repeating group I’m talking about is a number of ‘Social Profiles’ (Data type) linked to a profile (via a ‘Linked Social Profiles’ list type). How would I set the Custom State to equal the number of Social Profiles within the current users Linked Social Profiles list?

Thanks!

current users linked social profiles : count

Rapid… big thanks. And the data source for the RG, what would i set this as? I can’t seem to set my Custom State default length to the length of the number of linked profiles…

yes, so the custom state that you are using to create the list of numbers with the plugin is unnecessary and you can just in the plugin create the datasource to be 'current users linked social profiles: count + 1"

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