Im trying to make it that when the user signs up that their username is unique. I understand that the email is unique but in this case its for doctors and patients and the email cant be displayed to the user.
I have used the count option but found the delay in processing that can allow for entries to slip in. So I looked further and found the set slug option.
I have it set as
I figure Im not doing something or have missed something as the first entry it set the slug, the second entry it didn’t. I expected that it would not proceed. I was hoping for some indication as to how to set up a toast alert advising the username is taken.
Can someone tell me what I am missing or a better way to enforce a unique username
Hey, yeah thats the discussion I got the slug idea from. I just dont understand why its not creating an error when there is a repeated entry, instead its creating an entry with a blank slug. I had expected that when I entered Dr Jane Smith for the second time, it would do a check and come up with an error of some kind.
There’s a native conditional Can Have A Slug Value and Cannot Have a Slug Value. You need to implement it and display warning alert when datatype cannot have such slug. Cannot have means such a slug already exists. You can read more here.
If you need more help setting this up you can reach out in DMs.
P.S.
As far as I remember slugs are always unique. Although it allows you to create an entry with the same value I think it adds 1 at the end if the value is not unique before storing in the DB. Like Slug, Slug-1, Slug-2, Slug-3.