Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: ajax?

  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    ajax?

    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
    flying dagger

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.

  • #3
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    You can also hook into the onblur() event, so that it only verifies when they go into the next field.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by Fumigator View Post
    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.

    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •