I'm validating two records entity type and name using ajax but my problem now is that it works well all other browsers except firefox.
var basiccounter ;
function ServerSideValidation(contact_counter,detailed_counter,f,selection,o_name)
{
basiccounter = 0;
//sending entity type to the server
var urlEntity = "entity_type.php";
urlEntity = urlEntity+"?type="+document.getElementBYId(selection).value;
urlEntity = urlEntity+"&sid="+Math.random();
checkName(urlEntity,"GET", "sel_id", "lblEntity_error");
//sending official name to the server
var urlName="checkname.php";
urlName= urlName+"?q="+document.getElementBYId(o_name).value;
urlName = urlName+"&sid="+Math.random();
checkName(urlName,"GET", "txtOff_name", "lblOff_error");
CheckErrors(f,basiccounter);
}
function checkName(url, method, id, label,f,detailed_counter)
{
var xmlhttp = new GetXmlHttp();
if(method == "GET")
{
xmlhttp.open(method, url, false);
xmlhttp.onreadystatechange = function()
{
if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
if(xmlhttp .responseText != 0)
{
basiccounter++;
document.getElementById(label).innerHTML = xmlhttp.responseText;
document.getElementById(id).style.background = "pink";
}
else
{
document.getElementById(label).innerHTML = "";
document.getElementById(id).style.background = "white";
}
}
}
xmlhttp.send(null);
}
}
function CheckErrors(f,error)
{
if(error > 0 )
{
alert("found some errors on the serverside validation");
}
else
{
f.submit();
}
}
The code needs to function the same way in chrome,IE,opera,firefox and netscape