I have a page that has a text box that contains a part number. I have to validate that part number against a datasource (which works great), but I was asked if I could allow the user to type a leading portion of a part number, and if when they click on a search button, show (in a popup window?) a list of all parts that "begin" with that string. Then let them select one of those parts, and pass that back to the original text box and close the pop-up window. Here is what I have put together. The javascript im using doesnt seem to be working correctly. Any suggestions? Thanks =)
<cfquery name="myPart" datasource="mysxe">
SELECT prod
FROM pub.icsp where cono = 1 and prod like '#URL.pn#%'
<!--- WHERE EmpLogin='#form.UserID#' AND EmpPasswd='#form.UserPasswd#' --->
</cfquery>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function returnValue(){
top.opener.document.search.partnumber.value = document.found.chosen.options[document.found.chosen.selectedIndex].value
this.close();
}
</script>
</head>
<body>
<form name="DBMApprove">
<select name="chosen" onchange="returnValue()">
<cfoutput query="myPart">
<option value="#prod#">#prod#</option>
</cfoutput>
</form>
</body>
</html>
<cfquery name="myPart" datasource="mysxe">
SELECT prod
FROM pub.icsp where cono = 1 and prod like '#URL.pn#%'
<!--- WHERE EmpLogin='#form.UserID#' AND EmpPasswd='#form.UserPasswd#' --->
</cfquery>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function returnValue(){
top.opener.document.search.partnumber.value = document.found.chosen.options[document.found.chosen.selectedIndex].value
this.close();
}
</script>
</head>
<body>
<form name="DBMApprove">
<select name="chosen" onchange="returnValue()">
<cfoutput query="myPart">
<option value="#prod#">#prod#</option>
</cfoutput>
</form>
</body>
</html>