Think Good
View list of my frequently visited bloglines
Tags - Categories : All | General | Software Development

Lets say you have a new user registration page where you validate user entered loginid against the database using Ajax and immediately display available or not.

for this you might do like..

1. Detect onChange event of the text field
2. read input and call Ajax
3. process ajax output and display availability in the adjacent div or span tag using innerHTML.
Sometimes it may take a while for ajax to complete the process of calling the remote database and read back responseXML, now if you want to show a loading or processing screen for that moment ?, just use this tip.
While onChange event of the text field occurs...
function loginID_OnChange(){
  //set the div tag to show loading message
   document.getElementById("opmsg").innerHTML = "    checking availability...";
   // call the ajax for checking the loginid
   var result = myAjaxFunction(loginidvalue);
   // show the new value in the div tag
   document.getElementById("opmsg").innerHTML = result;
}


LoginID: checking availability...
Password: ....


LoginID: loginid not available. Please try another.
Password: ....


You can also find some animated activity gif from this site.


Cheers mate!! It helped me


Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 1 + 5 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/balajidl/addTrackBack.action?entry=1137187379092