Make a change to thing

I am trying to create an edit page. which doesn’t seem to be working as easily as everyone makes out.

The way I am trying to get it to work is that I have a search term box with a group focus element attached to it, so when I type the search term the results automatically come up in the repeating group within the group focus element. Then I am able to click on one of the items that are within the results and it populates input elements in the form. I can then change any of the information in those input elements. all works fine up till that point.

What I am wanting to happen now is that when I click the ‘save’ button it is supposed to change that field within the database. So I have used a workflow that has make changes to things attached to it, the thing to change is currently the repeating group, but I have tried multiple different things. I have also listed the fields to change. Nothing is changing when I click on the save button. the only way I have got anything to change is if I create a custom state for the repeating group and chose a specific item, e.g. first item or item #1. which works fine, but will only change that specific item no matter which item in the list I select.

I hope that is clear and that someone can help me understand where I am going wrong. Happy to open my app up if anyone needs to look at it.

Hi @justincswork :slight_smile: It sounds like you’re definitely on the right track! Happy to take a look at your app’s workflows if you’d like to set the app to public temporarily!

Hi @fayewatson,

Thank you, I think I have sorted it now. I had to make my set state a multi item list so that make changes to thing knew which item had been selected. Unsure if that was the most effective way to do it, but it seems to be working.

I am happy for you to have a look through and let me know if I have done things correctly or if there was a more efficent way of doing things.

what is the best way to allow you access… I am quite new to this

Sure thing! You can temporarily set your app to public by going to Settings --> General --> Application Rights --> and select “Everyone can edit” or “Everyone can view”. Then copy paste your editor’s URL into a new Forum reply here. :slight_smile:

Thanks, here is the URL. I have just made it view at the moment as if there are any changes I would like implement them so I can learn them.

Great! :slight_smile: Just to double-check, after a User checks one of the Spec Sheet cells in the GroupFocus element, you want to edit specific Spec Sheet in these elements and then click “Save” to modify that specific Spec Sheet?

Yeah, so in the ingredient name search box, they put the name or part of the name of the spec sheet they want to edit, choose the appropriate one from the group focus, which populates all the fields. they can then change the information in those fields if they need to. Once done they click save and the fields will be updated in the database.

Got it! :slight_smile: The way you have it could work but it would be an easier process is to use Bubble’s “Display Data” action. To set this up, you would first remove the custom states from the input elements in the Group Spec sheets element, and possibly change change the data type name from “Spec Sheets” to “Spec Sheet” (or “Ingredient”). You don’t have to of course but it might make it easier to see if you’re making changes to a single Ingredient or a list of Ingredients. Here is a similar example:

Editor:

Preview:

In this example, the repeating group on the left displays a list of Ingredients (similar to your GroupFocus repeating group):

Within that repeating group is the name of the Ingredient in a text element. That text element is inside of a group element that expands the height and width of the cell:

On the right side is our ‘Edit Group’ that we can use to edit the information about an Ingredient. This Group’s Type of Content is “Ingredient”, and by default, its data source is the first item in the Repeating Group of Ingredients:

Setting the data source of that Group to be the first item in the repeating group ensures that when the page is first loaded, the first Ingredient in the repeating group is edited. If we leave this empty, no information will be displayed in the Edit Group’s input elements, since the data source is empty. If you don’t want any Ingredient’s information to be displayed in that Edit Group, prior to a User clicking on an Ingredient, you would leave the data source empty.

Then we can use the “Display Data” action when an Ingredient in the RG cell is clicked, to display that Ingredient’s data in the right-hand-side group (this changes that Group’s Data Source via a workflow action). In this example, when the Group RG Ingredient element is clicked (i.e. an Ingredient is clicked in the repeating group) → Display that Ingredient’s data in the Group Ingredient element:


This action dynamically changes the data source of the Group Ingredient, and Bubble allows us to refer to that data using “Parent Group’s Ingredient’s…”. For example, in the ‘Edit Group’ inputs, that Ingredient’s data is displayed in the three input fields using these expressions:

Parent Group’s Ingredient’s Name
This dynamically displays the just-clicked-on Ingredient’s Name field value (type: text, list: no):

Parent Group’s Ingredient’s Approved
This dynamically displays the just-clicked-on Ingredient’s Approved field value (type: yes/no, list: no):

Parent Group’s Ingredient’s Source Address
This dynamically displays the just-clicked-on Ingredient’s Source Address field value (type: address, list: no):

You can see it dynamically changes the value once a RG Ingredient Group is clicked inside of the repeating group. Then, if we need to change any information about that Ingredient, we can use “Parent Group’s Ingredient” in the Make Changes to an Ingredient action once the Save button is clicked:


This action modifies the Ingredient we are editing’s fields, using the input values we’ve just modified.

After Bubble has made those changes, an alert is shown to the User stating that their changes have been saved:


Last but not least! In this example, when an Ingredient has been selected, its cell turns blue, and when a different Ingredient is hovered, its cell turns light blue. There are two conditional statements on the Group RG Ingredient element which accomplish this.

This conditional statement that changes the RG Ingredient’s background color to blue if it is being edited is accomplished using the conditional:
"When Group Ingredient’s Ingredient (the single Ingredient that is being displayed in the edit form) is Current cell’s Ingredient (the Ingredient in the RG) → change the background color to blue.

And that should work! :slight_smile: Please let me know if any of this was confusing or if I can clarify anything at all!

4 Likes

Thank you @fayewatson,

It is all a bit confusing as I am so new to bubble and trying to work out the lingo is slowing me down. But I have worked through some of what you have described and it definitely is a lot faster. I will adopt it and see how we go with edit function.

Thank you so much for your help. It will make what I am hoping to achieve with this and other aspect of my app, yet to be implimented/created, so much easier I think.

No problem at all, @justincswork! I hear you, I really struggled with all of the Bubble terms and concepts, especially those relating to data. It didn’t start to click for me until reading through a lot of examples and then trying to re-create those examples. But, re-creating them definitely helps things start to feel more intuitive! If you go through the above example more and have any more questions, please let me know any time. Also, this thread on Things vs List of Things may be helpful in understanding the difference between a single Thing and List of Things (no pressure to read of course, but just wanted to send it along incase it helps!) :slight_smile:

Thank you

1 Like