Currently I have a form where users can enter in the same ID (text) for each new record they create. I now want to add validation so that duplicate ID's cannot exist going forward.

Some of these records are locked and cannot be edited, so there may be a case where two records have the same ID and cannot be edited and are then used somewhere else.

My questions are:

  1. What is the best approach to handle new validation for existing cases, do I just rename them without telling the user: xyz_1, xyz_2, xyz_3?

  2. Users can currently edit the records (including changing the ID), however, if the user wants to edit another field in this record and then saves - the validation will show up "you have a duplicate record" - how can I handle this?

Hopefully that makes sense

Thanks, Sam

  • If duplicate records were not an issue, would your users want record identifiers that have exactly the same names? For example, you have three people in the system named John Smith, and all records would be "John Smith". Or would you never have records that need the same name (like inventory item numbers)?
    – Izquierdo
    Commented Nov 5, 2021 at 13:43

3 Answers 3


It depends on how much users care about defining an ID. A few questions and suggestions:

  1. Do users need to carefully choose the ID? Can you explain why?

If so start validating as soon as the user types in the field. As soon as it becomes a duplicate make the text red and show an icon or something else to make it accessible for color blindness. You probably also want to explain this to the user and a message nearby is the easiest and most accessible way. This immediate validation allows users to fiddle with the input and not get surprised afterwards.

  1. Do users somewhat care for what the ID is but not too much?

Do all of the above but also show a suggestion for a unique ID that extends to what the user already has filled in so far. Let them select it to replace it with the unique ID.

  1. Do users want a user-friendly ID and it is possible to generate one?

Generate the ID from data you already know. Or let users choose one from a suggested list, allow them to edit it and combine this idea with approaches 1 and 2 above.

  1. Do users not care about what the ID is?

Just generate one for them.


If the name of the record acts as an Identifier for you users then you should help your users to avoid making duplicate ID's.I would suggest you give them an error under the ID input field. "You already have a record with this ID". If it's not something required make the text color orange so it's just more as a suggestion rather an error.


I would never make the system edit anything without the users accept. So if you want to automagically change the ID values, you should definitely show a prompt to the user first to explain the changes that will be done. The only exception is if that ID is not important to the user at all, but then you should just always auto-generate the ID and not ask the user to fill it.

If that ID uniqueness check was introduced later, so you already have existing records with duplicate IDs, you could either ignore the older ones and just check the new ones for uniqueness.

Upon introducing new items I would mark the ID red/show a message just upon entering an already existing ID so they see it right away.

Never show duplicate record errors, show more exact error: the ID for this entry already exists on entry with (and use some other properties that can identify them like Name, Surname or something else). But, if possible, do it while in input, not on save or later. And make the UI not allow duplicating IDs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.