Welcome Guest, Not a member yet? Register   Sign In
realtime username control
#1

[eluser]Nuage[/eluser]
Hello again,
I am now coding a login application.
Here i have

username:
password:

when the user writes his/her username, i want to check if it is already exists or not without clicking the submit button. i mean with ajax, in realtime.

Any suggestions, code shares?

Thanks in advance
#2

[eluser]TheFuzzy0ne[/eluser]
Simply have a controller that's dedicated to validating the Ajax call. It can run the validation, and return any error messages.
#3

[eluser]jdfwarrior[/eluser]
What exactly are you asking? The easiest way to do it? How to do it?

Personally, (adding on to Fuzzy0ne) I would use jQuery to submit to a Controller/Function via the $.post method, have the controller, load a Model to, call a function and check username existence, and return true or false, passed back to the controller, and then passed back to jQuery. Let jQuery perform the appropriate action at that point.

And I assume by doing it realtime, you mean as they type each character.. You would need to perform the check using the onchange or keyup event in jquery.

Hope this helps.
#4

[eluser]bd3521[/eluser]
This could be dangerous.

Makes finding valid usernames a breeze - without even having to click the submit button a million times.
#5

[eluser]Nuage[/eluser]
what about if i can put a validation code also? i mean the thing to understand if you are a bot or a human..
For example:

Username:
Password:
Enter the code below:
yxd65c
Code:

huh? Smile
#6

[eluser]majidmx[/eluser]
In the code code which is responsible for checking the username via Ajax, put some more validation codes to prevent bots.
You can check HTTP_REFERRER / IP / TIME / ...
and find a best way to validate the username and prevent bots.
I don't suggest doing the validation by typing each character. I think doing it at onBlur will be good enough.

Also I think putting the captcha code just for validating the username is too much, I mean for validating the username user just needs to put the username.
Entering captcha will be usefull for submitting the form.

MajiD Fatemian
#7

[eluser]TheFuzzy0ne[/eluser]
[quote author="Nuage" date="1235181204"]what about if i can put a validation code also? i mean the thing to understand if you are a bot or a human..
For example:

Username:
Password:
Enter the code below:
yxd65c
Code:

huh? Smile[/quote]

I've never seen CAPTCHA validated via Ajax before, although it's possible, I wouldn't recommend it.
#8

[eluser]Nuage[/eluser]
Thanks to everybody who answered my post. All of the answers are very helpful. Thank you again and again. I will check jQuery. Never used it before. But i heard Dojo is better then jQuery. Any idea about it also?
#9

[eluser]majidmx[/eluser]
Dojo is great but I think it's too heavy.
jQuery is light weight and fast. But I still prefer to do simple things manually rather than using a library.
Simple Ajax calls can be done easily manually, but if you want some thing more complex you can test Spry, YUI, jQuery and so on ... there are tons of them. Depending on your needs.
#10

[eluser]Nuage[/eluser]
Thanks again millions of times. Smile




Theme © iAndrew 2016 - Forum software by © MyBB