Unique fonction for the fields

Hey,

I want to create an online chat app. The signup works like this: the user enters his email, his complete first and last name, a custom username, his password and he is invited to enter the name of who referred him to my website. The thing is, I have some fields associated with usernames, example: Jen03 is an Admin, JohnDoe96 is the founder and Jimmy.Peaceful is another Admin. Everyone can sign up, if the same email is took by someone, the app will decline it, but 10 people could connect on my chat with the same user name…

I hope there’s a way to say no to already used usernames…

Thanks a lot,
BOITE

PS: Sorry for my bad english…

During the registration process, you can make the workflow or action run ONLY WHEN the username doesn’t already exist. You’d use logic that say something like, “Do a search for users:count = 0” with a constraint of “Username = Input Username’s Value”

1 Like

Hey Andrew,

I did what you said… but the username only changes to no. Is there a way to decline some usernames?

Thank you,
BOITE

PS: Sorry for my bad english…

Hi Boite :slight_smile: Andrew is referring to adding that condition to the workflow as a condition. For example, if you have a setup likes this:

The workflow to save the Username that isn’t taken (the green workflow) would be:

Here, the Username is saved only when the search for Usernames that match the entered username is 0, and the typed Username is at least 2 characters long.

If the Username is taken, the workflow resets the username input (the red workflow):

This example also has a text element below the input which checks the input as the User is typing to see if the username is taken. In this page, the only username taken is “tomsmith” if you’d like to see what it looks like when a Username is taken:

Editor:
faye-demo-app | Bubble Editor (the page is called username_checker)

Preview: username_checker