I am getting this error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Timestamp: Wed, 20 Jan 2010 19:54:08 UTC


Message: Object required
Line: 1635
Char: 1
Code: 0
URI: http://www.domainName.whatever/index.cgi?pg=join_ajax

End of error...
Line 1635 has this:

<input type="text" name="email"  size="45" class="formfield" onblur="joincpf('join_ajax_files','vdd','1','na','email','val',document.getElementById('email').value,'email');" /> <span id="emailimg"></span>

Here is the ajax/javascript code:

function joincpf(pag,don,dov,varn1,varn1v,varn2,varn2v,fun) {
	request = createRequest();
	if(request == null) {
		alert("Unable to Create Request");
		return;
	}
	var nocache = new Date();
	var url = "index.cgi?pg="+pag+"&nw=4&"+don+"="+dov + "&" + varn1 + "=" + varn1v + "&" + varn2 + "=" + varn2v + "&stopIEcache=" + nocache;
	if(fun == "fnam") {
		request.open("GET",url,true);
		request.onreadystatechange = fname;
		request.send(null);
	} else if(fun == "lnam") {
		request.open("GET",url,true);
		request.onreadystatechange = lname;
		request.send(null);
	} else if(fun == "email") {
		request.open("GET",url,true);
		request.onreadystatechange = chkemail;
		request.send(null);
	} else {
		request.open("GET",url,true);
		request.onreadystatechange = chkemail;
		request.send(null);
	}
}


function fname() {
	if(request.readyState == 4) {
		if(request.status == 200) {
			detailDiv = document.getElementById("fnamimg");
 			detailDiv.innerHTML = request.responseText;
 		}
 	}
}
function lname() {
	if(request.readyState == 4) {
		if(request.status == 200) {
			detailDiv = document.getElementById("lnamimg");
 			detailDiv.innerHTML = request.responseText;
 		}
 	}
}
function chkemail() {
	if(request.readyState == 4) {
		if(request.status == 200) {
			detailDiv = document.getElementById("emailimg");
 			detailDiv.innerHTML = request.responseText;
 		}
 	}
}

The script that ajax loads in the back end just prints a line of html, usually an image with some text next to it for example:

<img src="/images/data_error.data" border="0"> Field Required!

I use ajax on other pages without any errors. Not sure why this one is having any problems. I'd love some feedback. Thank you much,
Richard

document.getElementById('email').value

Gets the element by id, not by name. So add id="email" to the input.

From the error it seems that

document.getElementById('email').value

is failing. Please check if there is any missing element with id="email" in the code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.