Can I create a database entry from a text box

I have created a list inside a regular group (not a RG). Each item on the list is in its own text box. When the user selects one or more items on the list, there is a custom state for each entry that causes the selection to change color. The user can reverse one or more selections by clicking once more on the selection they wish to reset.

My question is, if I create a submit button for the overall list, how do I set it up in such a way that the user selection on that list (the items with a blue background and white font) end up in the user’s database in the field I assign for that function? I don’t want to use checkboxes for the particular UX / UI that I’m after.

(FYI, when the user clicks on the submit button, after the selection is saved in the database, the user will be navigated to another page (a dashboard) where a repeating group will show them their selection, amongst other things.)

Thanks in advance.

Hi @cantinmario ,

One approach to achieve that is by having additional custom state with the same content of the text. Then for the button clicking event, you setup an action for each text to add the content custom state to a field of user data with checking whether the text is selected or not.


image

Alternatively, you can create a list custom state to store the selected text then add the list to the user data when the button clicked.

Hope that helps.

My apologies for answering with a question, but may I ask why you didn’t use a RG? It sure seems it would be much easier to implement and maintain. It’s quite straightforward to allow multi-select / deselect with a RG.

Because the list is static. The items don’t need to be searched for, retrieved or input. They are an unchanging list that the user selects from.

That doesn’t matter. An “unchanging” list can still be created either in the DB or as an option set. I think it would simplify things quite a bit.

Ok, I don’t doubt you are correct at this point, as I’m relatively new to Bubble. I had assumed this couldn’t be done. But still, I have no idea how to implement it as you suggest. I yet have to learn what an option set it. I’ll study the link above and probably watch a few YouTube videos on the topic. So I need to dig deeper and learn more of Bubble’s functionality so I can understand all the options offered in this thread so far. Thank you for the recommendation.

You can basically think of them as “static Things”. An option set would be ideally suited to your use case. That should be clear from the initial sentence in the link I provided…

Anyway, good luck!

-Steve

Thanks again for the reply and prompt willingness to help. I’m glad to be finding out about options sets as they will undoubtedly become handy in the future, but after having investigating this for the last few hours, they will not suit my needs in the exact context of this thread. I need the text selections to be saved in the database with privacy options.

Hi, Thank for the reply. I greatly appreciate the help.

One approach to achieve that is by having additional custom state with the same content of the text.”

Let’s say the list has 15 items. For each items (in other words, for each text box within the overall group), I have created a group so that the customs states that allow for the blue selection are stored there. So when you say "having additional custom states, you mean I should create 15 new custom states, one for each text field and stored in its corresponding group, along with the custom state that is already stored there, correct?

Then for the button clicking event, you setup an action for each text to add the content custom state to a field of user data with checking whether the text is selected or not.”

So that means creating two workflows for each text field, one for the “yes” value and one for the “no” value, is that correct?

(You second suggestion of creating a list custom state will not work, as far as I understand it, as various text selections will be directed to different database fields, but thanks for taking the time to suggest it.)

That should certainly be possible with option sets. In fact, it’s far easier to do with an option set and RG than it would be with a bunch of text elements. I think you’re over-complicating things.

-Steve

I’m going by what I read in the manual:

"However, there are a couple of downsides compared to custom types:

There are no privacy settings for options. So, do not put sensitive data as an option’s display or one of its attributes."

You said you’d be saving the value to the DB. That’s where you’d apply privacy settings.

Either that, or simply store the menu options in the DB instead of an option set. If the options were stored in the DB, you could even control which options were displayed for a given user.

-Steve

Hi, after I did a bit more digging so I could fully understand your instructions, it worked beautifully. I could not have made it without the three screenshots you’ve included. I therefore thank you profusely for not only replying, but to also take the time to make sure your instructions would be clear enough for a not-so-advanced user. Cheers!

1 Like

Glad it works!

1 Like