Edit unique value in custom form

Hello everyone,

I have a custom form in my app, which uses relations to check if a value exists. This way, I check if an email address exists when creating a user in the app. This works perfectly fine. We do this also for a few other fields that need to be unique to prevent duplicate values.

However, I want a form to edit the details of this user, which gives a problem. When I open the ‘edit’ custom form, it has all the fields pre-filled with the current values. You can change one or two or none and save those changes. However, you can’t keep the form, as the fields with the unique values show an error that the value already exists.

I need a way to exclude the fields of the current user from this check. So I do want to check before saving if the email value exists in any other user, but I don’t want it to give me an error if I don’t change it because the vale exists in the user itself.

Anyone able to help with this?

If you take a look at my Custom Forms demo, it handles this (preventing duplicates on edit).

The trick is to set a column in a separate table with the name of the record being edited, then build an array which excludes that name, and then finally use that array to build a relation back to the source table.


Hey, that was the demo I used to make custom forms in the first place :slight_smile: I didn’t know it had something for edits. I will take a look; thanks a lot!

I added that recently.

Here is a video that explains how it’s done:


Perfect, thanks a lot

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.