Unique Username Check

Hello,

On my signup form I’m trying to make sure the user is entering a unique username.

I’ve been trying to figure it out with no success.

1 Like

Screen Shot 2020-09-13 at 12.15.06 AM

Hi, @samhouston1107 I think this condition will solve your problem.username works help

Hey @samhouston1107

The way I did it:

Works fine on my end!
Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

This is for my signup form. I don’t want the user to gain access within the application if the username is already in use. I also need to send feedback to the user letting them know why they can not login. Example [Username is already in use].

This didn’t work for me also.

@samhouston1107

Not sure why it’s not working on your end, but the logic is pretty basic.
The Search for Users:count > 0 basically looks in the database if there is at least 1 user with the username informed in the input field. If there is, the ‘Signup’ button is not clickable. From my understanding it should fit your use case right?

Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

This condition should do the job for you. I’ve tried this on my login page, and it works. You can add custom properties to send feedback, for example, I used the font color feature.

Hey @batuhanmerguz

I agree that it should work, however the ‘contains’ function is not best practice for that particular use case.
It would mean that if a user’s username is ‘test’, then other users wouldn’t be able to choose ‘test123’ as a username, even though it would be unique in the DB.

Cheers
Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

Hi, @ambroisedlg

They changed the ‘contains’ function in this month’s updates now you can use it without hesitation.

Currently, if a user’s username is ‘user’, then other users can take user123, etc.

2 Likes

Right thanks @batuhanmerguz good to know! I actually saw that update but I think I’m still used to the previous ‘contains’ function

Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

1 Like

I tired this way

And I tired this way. @ambroisedlg I booked a session with you for Monday also. I’m sure I’ll need your help throughout my MVP development.

Screen Shot 2020-09-13 at 12.34.10 PM

@samhouston1107

Try replacing the Username = Username’s value by Username = Username Input’s value

Also, you should not put the condition on the input itself, you should put it on the ‘Signup’ button so that’s it’s not clickable when the Username is not unique

Awesome looking forward to meeting you tomorrow!

Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

Hello all,

@samhouston1107

To make it unique you’ll need to take into account multicase too. When I save to db I save in lowercase and trim the value. Then in the search constraint convert to lowercase and trim the search value.

Hope this helps .

1 Like