I want to implement Username auto suggestion while Registration like Gamil or Yahoo is providing. How can i do that.
Thank You
Updated
Gmail/Yahoo AutoSuggestion
Gmail is suggesting a username by generating a Random String depending upon the First name and Lastname by adding some random characters to it.
ex: firstname: john
last开发者_如何转开发name: smith
Autosuggested Name: johnsmith198, john.34smith, smith45.john etc..
The way I would do it would be to ajax the suggestions from the server, sending firstname and lastname as the parameters. The server would generate the random usernames and check they dont exist.
Something you would have to consider is two concurrent users signing up at the same time. You would therefore probably need to 'reserve' the generated usernames so that two users cannot receive the same suggestions.
The way THEY do it is by considering the FIRST NAME and LAST NAME that a user enters, also sometimes the birthdate etc. After considering the FN and LN their code searches closest UNUSED username. Say like FN.LN, LN.FN, FNLNbirthdate or FNRandomnumber.
Obviously you'll have to CODE or copy code from somewhere as to what exactly your Application would suggest the username as.
If any problems still i would be glad to help :)
精彩评论