First off, this platform is amazing, for someone who’s always felt limited by standard website builders and not having programming background - this is the ultimate playground!
I’m working on an application that multiple users will be accessing simultaneously. The issue I am foreseeing is having 2 or more users on the same page, changing the same information for the same Thing (which in my case is a Bill).
The users will click “edit bill” and the current bill will be send to the “Edit_Bill_Page”. I’m thinking one user will “Save changes”, which will make changes to that bill, and the second user will overwrite those changes because they had no idea someone else was editing the bill.
Is there a way for me to not allow a second user (on a different computer) to access a page if another user is already on that page? Or even just make an element visible showing that more than 1 user is on the same page?
You can implement the “Locked” yes/no field in the data type. So, when a user visits the edit screen (page or group), you can set the field to yes. You can check this value before displaying the screen. When a user presses “Save” or “Cancel” on the edit screen, you can change the field back to no. The trouble is if the user leaves the screen in some other, uncontrolled way … Maybe someone else has a solution for that.
Another, more systematic way to tackle record locking was discussed here:
I did try that option, but like you said there are issues when someone exits the tab, or even uses the return arrows in the browser instead of using the “return” button.
I think you want to “lock” the record not the page.
The question is what do you want to happen if the user does close the browser ? It is up to you to design your strategy.
The optimisitic lock that I described in the linked post would seem to be a reasonable choice. So read the “last updated” date on page entry, and then check that it is still that timestamp on update.
I prepared an example for this, and it seems that it works but please check it out.
When the first user goes into ‘edit mode’, the custom state of input box is set to current date & time. When he clicks the save button, the condition in the save workflow checks whether the item’s modified date is less than custom state’s time.
As Nigel said, you have to add the logic what happens then also from UX point of view - the user should be notified about that. I can imagine that Bubble could also show the changes made by the other user.
I think that could get into issues with time zones etc.
But essentially the other way is much the same, except you grab the modified date instead of the current date. Then you only update if they are the same.
Hmmmm, no, current date is offset. But set by the devices time. I was wondering more about the modified date. So if it was modified in another time zone. But thinking about it, that should work as everything should get converted to local time in the same way at the same time.