Custom Input Field Cells for a Repeating Group

Hey guys,

I’m trying to build out a repeating group that can create/delete cart item input fields, but each cart item input field would have no initial value, since the user will be adding data for each cart item.

I want a new cart item input field to show up every time the user presses “add another item” but also be able to disappear when they click the X button.

I’m finding this difficult because it seems that the repeating group must have stored data in order for this to work.

I can do this manually and create 10 cart item input groups without the repeating group, but just checking to see if there’s a better way to do it.

Here’s the concept I’m trying to mirror:


Hey :wave:

I think there are a few ways to do this. The first way I thought of is just adding a blank item to your list when they press the add another item button. Then it adds it to the list. Is there a reason you can’t just do that?

You can just delete the item if they remove it from the list.


Hope that helps! :blush:

Hi Jason,

I was thinking about that but didn’t want to create a new piece of data every time a cart item added.

Instead, all the data (from the custom states) would be created once the submit button is clicked.

The reason it needs to use custom states is if someone clicks off the page, the data would need to be deleted.

I was thinking about potentially creating a data type called “Cart Item Input” and making about 10 of those, an exact replica of the Cart Item data type but everything for “Cart Item Input” would be blank in the database. Then, display “Cart Item Inputs” in the repeating group and recycle those 10 “Cart Item Inputs” for all the users and never add/store data for “Cart Item Inputs,” just use them as a way to store custom state data and transfer it to data for the cart items in the database (when cart items are created).

Is that similar to what you meant?

For some reason when saving lists from custom states I would always have issues. Not sure why. So, sometimes what I do is just create the item and schedule an API Endpoint to check after a day to see if it was empty than it can just be deleted.

If you can get the set states list to work, that would be best.

If you have an idea that you think works, try it out. Let me know if it works for you. Otherwise, we can brainstorm some other ideas. :+1:

Hope that helps! :blush:

1 Like

Hello. Just use custom states.

Check this link:

1 Like

Yeah that seems like the best option for now, not to use the repeating group like in your case. Thanks guys @grace.hallak @J805

You are welcome. You can put the group in a repeating group but you may need to configure it a bit. I think this solution is very simple and very straight forward. You need at some point a condition that tells an element when to show and hide. In this example, the condition is the state’s value and you can make something else.

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