My problem is: when a user presses a key, a div will be shown with all the users who have a firstname starting with the users input. It's mandatory that I need to select something. The problem is when user enter an invalid entry instead of selecting it from the showned div. How to validate it
function getDcode(str)
{
document.getElementById("codes").style.display = "block";
if (str.length==0)
{
document.getElementById("codes").innerHTML="";
return;
}
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Your browser does not support XMLHTTP!");
return;
}
var url="<?php print WEB_URL?>load_code/";
url = url + str;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}