Jump to content

Problem with AJAX Registration


XoSilenceoX

Recommended Posts

I am creating a registration form that uses php to validate the content. The problem Im running into is that the function is don onblur. so when someone completes a field it progresses & progresses to the next it will start a check. The problem im running into is that if someone types fast or changes fields quickly via the mouse or tab it cancels the previous request if they have not completed.

 

Im using the following ajax script.

 

var http = false;

if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}

function register_ajax(Varea,Vlink) {
http.abort();
document.getElementById(Varea).innerHTML = '<img src="images/ajax_loading_small.gif">';
http.open("GET", Vlink, true);
http.onreadystatechange=function() {if(http.readyState == 4) {
document.getElementById(Varea).innerHTML = http.responseText;
}
}
http.send(null);
}

 

 

Heres a 2 part example of the form I am using.

 

 

<table width="450" border="0" cellpadding="5" cellspacing="0" style="border:1px solid #CCCCCC; font-weight:bold;">
<tr>
<td width="1%" align="left" valign="middle" nowrap="nowrap"><img src="images/information.gif" width="16" height="16" /></td>
<td width="1%" align="left" valign="middle" nowrap="nowrap">EMAIL ADDRESS:</td>
<td align="center" valign="middle">
<input type="text" name="EMAIL" id="EMAIL" class="sitetext" style="width:100%" onblur="register_ajax('checkemail','register/email.php?check=' + this.value); " /></td>
<td width="1%" align="center" valign="middle"><div id="checkemail"></div></td>
</tr>
<tr>
<td colspan="2" align="left" valign="middle" nowrap="nowrap">VERIFY EMAIL:</td>
<td align="center" valign="middle"><input name="VEMAIL" type="text" class="sitetext" id="textfield6" style="width:100%" onblur="register_ajax('checkvemail','register/vemail.php?check=' + this.value + '&check2=' + document.register.EMAIL.value);"/></td>
<td width="1%" align="center" valign="middle"><div id="checkvemail"></div></td>
</tr>
</table>

 

Any help would be greatly appreciated. This is a very big project for me and I am trying to figure this out as soon as possible. Thanks.

 

If you want to see a working example of the problem go to http://sincitybeats.magicalfta.com and click on the coming soon. Then click on the Register link. I have tried changing the loading image to an onstate change event and still same results.

Link to comment
Share on other sites

hi

http.abort();

is aborting your request and what you are facing is the problem faced by many.I always prefer to make only one ajax request and then send it over the server and get the response in mean time you can show the waiting faiure too.If there is possibility of network cogestion then the validation will behvae very differently.

 

so once user fills up the form create a signle ajax request and populate your error_string and show accordingly.

 

 

Link to comment
Share on other sites

hi

http.abort();

is aborting your request and what you are facing is the problem faced by many.I always prefer to make only one ajax request and then send it over the server and get the response in mean time you can show the waiting faiure too.If there is possibility of network cogestion then the validation will behvae very differently.

 

so once user fills up the form create a signle ajax request and populate your error_string and show accordingly.

 

 

 

I tried to remove the http.abort(); also sorry didnt state that in the first post. It still gets the same results. I know this is possible as google maps uses the same command and just coords to identify which image to load. Anyone got any solutions. Even a different script all together i can work with.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.