[Form] Save Dropdown values in a repeating group

Hi everyone,

Following on some advice in the forum, I’m creating a Form using a repeating group.
Each cell (ie. line) is a question + a dropdown

To give you an overview of the model:
1/ Dropdown choices are “Items” (an object containing a value + a label)
2/ Questions (ie. each cell in the repeating group) is the question label + a list of Items

Display works fine.

But I’m stuck when trying to save the results of what the User selected.

In the workflow, I imagined that I would be able to save the data from “repeating group’s list - each cell’s - each dropdown value (and by value I mean the Item)”.
And save that as a list.

However, it does not seem possible to get all dropdown values… :confused:
(I managed to save all the items, but I just want the ones the user selected in the dropdowns, not all choices)

Thoughts?

Best,
Ben

I think you will need to save each drop down as it changes. Rather than do it all at the end.

1 Like

That’s correct, that’s the right approach here.

Thanks for the help guys.

But if I use this approach: how can I manage the case when a User changes the Dropdown’s value?
I would need to replace the existing value.

I couldn’t find a way to do this.

Cheers

You would do “Make Changes to a Thing” in the workflow that is driven by the dropdown value being changed.

So set the field to the new one chosen. That is the “replace”.

Instead of waiting until right at the end of the process to save everything, you create a skeleton thing on the page load, then keep updating it as you go along. If you want a “Done” button then you can have this save some sort of status, updating it so that you know you have completed all the data entry,.

Thanks again Nigel for the tips.

I think my previous message was not clear enough.
I’m not saving my values in different properties: I’m using a list of things.

Unless I’m mistaken there’s no way replace an item in a list (only a set the list feature which requires a list as input).

Thus, when a dropdown is modified (eg. item N) I need to replace the previous value in the list by the newly selected item.

Here’s an example:

  • Let’s say I have 3 questions (question A, B, and C), in my repeating group, each with its dropdown
  • User answers in the dropdowns: answerA1, answerB1, answerC1
  • Each time a dropdown is modified I save the info in my list of things, resulting in [{answerA1, valA1}, {answerB1, valB1}, {answerC1, valC1}]
  • Then the user changes his/her mind for question B, and chooses answerB2

The result I want is [{answerA1, valA1}, {answerB2, valB2}, {answerC1, valC1}]

Ok, finally found a way to make this work.

As mentioned before, I’m triggering events on Dropdown value change.

And to be able to remove the previous elements: I’m using a custom state for the Dropdown (I’m saving the current choice in the custom state). This way if the user changes his mind, I know which item to remove.

NB: 1 problem I have with this is that I haven’t found a way to re-establish the custom state at page load > this solution is not perfect yet as it does not allow me to edit an existing form.

Ah, OK, yes I think I am with you know.

Custom states can help here. You could also save these on the user, if you need to persist the data.

Are you having trouble setting up the custom state on page load ? Assuming you can’t get it from the saved data, then storing state on the user might help. I have persisted user choice through this route, although not as complex as yours.

Yeah, I don’t see how I can set a custom state for the Dropdowns in the repeating group.
(I have access to the correct data: I’m using it to set the initial value for the dropdowns)

For instance, I tried using the “When page is leaded”: I have access to the Repeating group, but not the Dropdowns.

Thoughts, anyone?

Right, you can’t access elements in the repeating group from the outside, since we don’t know which cell we’re dealing with.

Can you reproduce the situation in the forum_app so that we can help there?

I’m running into a similar challenge and was wondering if Bubble supports any simpler / more straightforward solutions to this type of challenge? I ask because this thread seems to be 235 days old.

Thanks.

Well the fact that it doesn’t make sense to refer to an entry in a rep group from the outside hasn’t changed. Which limitation are you talking about?

I’m not sure I understand what you mean by “from the outside” – I’m still fairly new to Bubble. That said, I’m using a repeating group to collect an series of input fields and need to find a way to store these in our database and associate it with the other data I’m collecting in the same form. Just trying to understand how to best solve for this.

Some complicating facts:

  1. The repeating group is triggered based on the user’s selected value to an earlier question.
  2. I’m not using a list of things to store the answers because I’m going to need more than 1,000 rows.
  3. I’m using this form to create new user accounts for other users.

Thanks for the help. I appreciate it.

HI Sridharan.s have this same issue. How did you resolve it?

2 Things to know…

  1. The only way I know to save data from repeating groups is to save the data immediately when it’s changed because there’s no way to save it later. So, use a “when input field’s value changes” workflow and then save the data immediately.

  2. We’ve ripped out all saving of data from a RG in our app where possible because it doesn’t work all of the time. Since it must save it right away and a user could say, change values twice sometimes the first value will hit the database after the second one and that’s what’ll save. Sometimes, it slows the page to a standstill. Sometimes, it creates other bugs that we could never figure out. So we try to always avoid this if at all possible, even if that means loading 10-20 of the exact same drop-down or input field.

Thanks so much for your response. Is there any other way to display data and then use it to records in a database?