How can i check the username is available? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i check the username is available?

I’m creating a sign in page, but how can i check the username is available?

2nd May 2020, 7:33 AM
Allan Nguyễn
Allan Nguyễn - avatar
3 Answers
+ 4
You can't simply create a sign in HTML page, you need to write server code to get user signin submit response from this page, and compare the data with database.
2nd May 2020, 7:36 AM
Calviղ
Calviղ - avatar
+ 4
I am assuming that you have a Database. In JavaScript you can use "change" event on a textbox where user is going to type his username. inputField.addEventListener('change', checkAvailable); Now the checkAvailable function will check into database if the username that is typed I available or not. function checkAvailable () { //Checking code goes here }
2nd May 2020, 7:37 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
In most systems, your registered usernames would most likely be stored in a database or something similar in the backend. When your user submits their preferred username during sign up, you'll crosscheck that string with what you have in your db and make sure that the submitted username is unique. Is this what you meant by "available"?
2nd May 2020, 7:39 AM
Hatsy Rei
Hatsy Rei - avatar