Hi Vivian,
I don't think Mendix has a built-in option to prevent users from opening the same edit page in multiple browser tabs.
One workaround is to create a lock mechanism. When a user opens the edit page, store the user and object details and mark that record as being edited. If another tab or user tries to edit the same record, show a message that it is already being edited.
You would also need to handle cases where the user closes the tab or the session expires, so the lock can be released.
If you only want to prevent accidental overwriting when multiple tabs are open, you could also check whether the record was modified before saving and warn the user if it has changed.
Regards
Reemali
Hi Vivian,
You can't stop the browser from opening a new tab, but you can prevent the same object from being edited in two tabs (or by two users) at the same time. Which approach fits depends on your Mendix version and on what exactly you want to prevent.
1. Optimistic locking: prevent overwriting
If the goal is to stop one tab from silently overwriting changes made in another:
MxObjectVersion), and a commit based on stale data fails with an optimistic locking error, which you can handle in your Save microflow (for example by showing "This record was changed in the meantime, please reload"). See the docs page "Optimistic Locking".Version (Long) attribute, plus a helper attribute such as LoadedVersion that you fill when the edit page opens. You need the helper because the object passed to a microflow reflects the latest state, not the value the page was opened with. In the Save microflow, retrieve the current DB Version, compare it with LoadedVersion, then either block the save or increment Version and commit.2. Pessimistic locking: allow only one editor
If the page must not be editable in a second place at all:
sessionStorage, which is per tab, and use it as the lock token. Take the lock when the page opens through a nanoflow and microflow. Release it on Save and Cancel, and add a timeout, because closing a tab doesn't reliably trigger anything. Note that when a tab is duplicated, browsers copy sessionStorage too, so regenerate the token on page load if you need strict behavior.3. Reduce the ways to open a second tab
Open the edit page as a popup without a page URL. This doesn't enforce anything by itself, but it removes the most common "open in new tab" path.
In most cases optimistic locking (option 1) is enough. Use pessimistic locking only when exclusive editing is a real business requirement.
Hope this helps!
Hi Vivian,
Mendix does not provide a built-in setting to prevent users from opening the same edit page in multiple browser tabs. Since users can open links through browser controls, you cannot reliably prevent this through page configuration alone.
If your goal is to prevent the same record from being edited simultaneously, you can implement an application-level record-locking mechanism.
IsLocked (Boolean)LockedBy (association to Administration.Account)LockedAt (DateTime)Important: Make the lock acquisition atomic to avoid two users opening the record simultaneously and both acquiring the lock. Also, don't rely only on the Save button to release locks, because users may close the browser tab unexpectedly.
Mendix database write locks alone won't solve this: they protect updates during a transaction, but they do not prevent two users from opening and editing the same record at the same time.
If you only want to prevent users from opening a second tab, rather than prevent concurrent editing, that is a different requirement and would need a browser-side solution.
Hope this helps.