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.
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.
Hi, @samhouston1107 I think this condition will solve your problem.
Hey @samhouston1107
The way I did it:
Works fine on my end!
Ambroise
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.
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
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
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.
Right thanks @batuhanmerguz good to know! I actually saw that update but I think I’m still used to the previous ‘contains’ function
Ambroise
Book a free 15 minutes call - happy to help if I can
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.
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
Book a free 15 minutes call - happy to help if I can
Hello all,
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 .
Is there any way to make it not to be case sensitive (for exsample: when there is a username ‘hello’ can I block a user from getting the name ‘Hello’ or ‘HELLO’)