Dynamic select list - problem passing value back to calling

admin

Administrator
Staff member
I'm hoping someone can help me out. Although I am using ColdFusion, it shouldn't really matter since my problem seems to be with JavaScript. Here's my situation:

I have a CF page that prompts for a part number. If the person doesn't know the part number or only the beginning of it, they can hit a 'Search' button. If that button is hit, I want to open a pop-up with a dynamic select list of all parts that begin with whatever string they've typed into the part number field. I am using JavaScript to do this, but am not a JS programmer, so I'm sure I have something wrong. Here's what I have so far:

PARTNUMBER.CFM
...
<form name="myform" method="post" action="order_submit.cfm?SupervEmail=#SupervEmail#">
<input name="partnumber" type="text" size="44" Required="yes" MESSAGE="'PartNumber' cannot be blank">
<input type="button" class="h2" onClick="searchWindow('search.cfm?pn='+document.myform.partnumber.value,'window2')" value=http://www.webdeveloper.com/forum/archive/index.php/"Search">
...

SEARCH.CFM
<cfquery name="myPart" datasource="tci">
SELECT prod
FROM validprod where prod like'#URL.pn#%'
</cfquery>
<html>
<head>
<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="found">
<select name="chosen" onchange="returnValue()">
<cfoutput query="myPart">
<option>#prod#</option>
</cfoutput>
</form>
</body>
</html>

I get the select list pop-up fine. I can select one of the items fine, but on selecting the desired part, nothing is passed back to my text box in my calling page and the pop-up is not closed.

If there's someone out there who can help me, I'd REALLY appreciate it. This is a real sticking point and I'm desperate!

Thanks a million.
Steve
 
Back
Top