Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autocomplete Not Working

Status
Not open for further replies.

ElJayWilson

Programmer
Oct 31, 2008
19
0
0
US
I just cannot get this to work. I am trying to use an Autocomplete with a windowing system and it just won't work. Here is the code I use to create a window:
Code:
function createwindow(parameters)
{
	dialogopen=true;
	var divid = parameters['divid'];
	var title = parameters['title'];
	var text = parameters['text'];
	var width = "width=" + parameters['width'] + "px";
	var height = "height=" + parameters['height'] + "px";
	var resize = "resize=" + parameters['resize'];
	var scrolling = "scrolling=" + parameters['scrolling'];
	var center = "center=" + parameters['center'];
	var settings = "'" + width + "," + height + "," + resize + "," + scrolling + "," + center + "'";
	var firstinput = parameters['firstinput'];
	var myhtml = "";
	var wintype = "inline"; //parameters['wintype'];
	var winloc = parameters['winloc'];
	
	myhtml+= ' <form action="" onsubmit="return false;" name="dialogform" id="dialogform" class="dialog">';
	myhtml+= ' <table id="dialogtable" cellspacing="0">';
	
	myhtml+= parameters['html'];				  
				  
	myhtml+=	'</table>';
	myhtml+=	'</form>';
	dialog=dhtmlwindow.open("mywin", wintype, myhtml, title, settings);
	//dialog=dhtmlwindow.open("mywin", wintype, winloc, title, settings);
	//var myobj = actb(document.getElementById('tb'),collection);
	dialog.onclose=
		function () { 
						dialog.hide;
						dialogopen=false;
						clearinput(); 
						return true;
					  }
		
	if (wintype=="inline")
	{
		if (firstinput)
		{
		       var element = document.getElementById(firstinput);
		
// Use a delay so that IE will give focus properly
			setTimeout('document.getElementById("'+firstinput+'").select()', 100)
			
			document.getElementById(firstinput).value="";
			document.getElementById(firstinput).focus();
		}
	}
}

I have tried several autocomplete methods, with the best one I saw being here (
I know this must be a DOM issue, but I just cannot get the autocomplete box to work. When I use the windowing system, I have access to the elements on the form (textbox values, etc).

I can send more code if needed. BTW I am using a PHP script to generate the original page. I am also using the following code to capture keypress events:
Code:
document.onkeydown = getkeycode;

The autocomplete script also uses the onkeydown event to do stuff, so maybe that could be causing issues. If there is a better way, let me know. My whole goal is to have an autocomplete system for the user to type in a name. I populate an array of all customers when the main javascript page loads.

Thanks,

LJ
 
How about a URL to the page? Chances are if I tried to run the code above as-is, half of the libraries you are using would be missing.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
It is on a private network. The issue is definitely a DOM issue I think. I can get the autocomplete to work just fine when it is on its own page. When I try to add the textbox to the form I generate using a javascript window, it doesn't work.

LJ

P.S. The javascript windowing system I am using comes from DynamicDrive (Window Widget).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top