How to Prevent Duplicate Names in Database with Multiple Keywords?

Hi, Senior Bubblers. I’ve been struggling with this issue, and I could really use some help here.

I’m trying to create a conditional where users cannot register the same name that already exists in my database, regardless of the case. This is important because I plan to create a slug from the saved name.


Currently, I can only make it work with a single keyword. For example, if I have a company registered as “Google,” my conditional text ‘Company name already exists’ successfully shows up for variations like ‘google,’ ‘googlE,’ ‘googLe,’ ‘GooglE,’ and so on.


However, the problem arises when I change “Google” to “Google Company.” The conditional still reads it as if the name is already taken, preventing others from using “Google” as their company name.

Here is my current conditional.

Pardon my novice skills. I would be incredibly grateful to anyone who can help me solve this issue. Thank you so much in advance!

Well slugs can only be lowercase. So, Do a search for company where slug is input’s value:lowercase. If first item isn’t empty, don’t allow that company name. Then anywhere in your app where they can change company name, make sure you do that check to make sure the slug isn’t taken, then if it’s valid update the company name and set the slug.

Brilliant! I can’t believe I didn’t think of that before. Thank you so much, George @georgecollier . I appreciate your help. Have a fantastic day!

1 Like