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?