...

View Full Version : ajax?



xiaodao
03-09-2007, 07:26 PM
Hi

today i saw one very interesting form effect, basically it consist of four textbox "user, email, password, confirmed password", i noticed that when i fill in the username which is not in database, a tick is appeared behind the text input box immediately, when the username is in the database, a cross is happend , same thing applies to email, and for password, i think the form actually checks the number of password whether more than 8 chars or not, a tick also appeare, and password also confirmed using this method

my question is this kind of form use all php or i mean also use php to validate the password or they use js for password but sql query for username? how to do this kind of auto check with request user to press a "check" button? anybody kind enough to provide a sample codes for me to study?


Thanks

Fumigator
03-09-2007, 09:12 PM
Yes this sounds like a job for Ajax, which you can google for all the examples you can stomach. The drawback is they are hooking the Ajax call onto the onkeydown() event, so every time you type something it causes server overhead. If your server can handle it then fine, but it is an expensive method.

aedrin
03-09-2007, 09:37 PM
You can also hook into the onblur() event, so that it only verifies when they go into the next field.

Fou-Lu
03-10-2007, 08:39 AM
Yes this sounds like a job for Ajax, which you can google for all the examples you can stomach. The drawback is they are hooking the Ajax call onto the onkeydown() event, so every time you type something it causes server overhead. If your server can handle it then fine, but it is an expensive method.

:D
I did just that on my first ever ajax script, and it was a horrible experience. Then as aedrin mentioned, I quickly switched to the onblur methods instead. I felt err... not smart when I did that :(
On topic, ensure you are not trusting any types of validation to the tied ajax script. Remember, JS and activeX (for IE) are controlled by the browser and are therefore unreliable. Use it purely for the asthetic use for the users.
Another possible option you can look at to help keep your overhead down is to import a server created xml file that contains only the taken usernames. Granted you have to actually read the file to incorperate this method, but you will reduce the overhead on at least your database.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum