I have Parent page and a Child popup window page (empW.cfm). The Child page has search field, that searches and displays results. I have to select one search result from thre Child page and populate it on the Parent page.
I am unable to pass the correct selected value from the Child to Parent page.
Parent page:-
<script type="text/javascript" >
function doSubmit() {
var Emp = document.getElementById("emp");
var getName = document.getElementById("getName");
Emp.value = getName.value;
}
</script>
</head>
<body>
<cfajaximport tags="cfform,cfwindow" scriptsrc="test.js">
<cfform action="Action.cfm" name="formE" id="formE" preserveData="true" enctype="multipart/form-data" method="post" onsubmit="return validate(document.formE);" >
<table >
<tbody>
<tr><td > Name*: </td><td><cfinput name="Name" id="Name" type="text" ></td></tr>
<tr><td > EMP:</td>
<td><input name="searchName" id="emp" onclick="ColdFusion.Window.create('w1','Title','empW.cfm')"></td>
</tr>
</tbody>
</table>
</cfform>
Child/Window page:-
<cfform name="formI" id="formI" preserveData="false" method="post">
<table>
<tr>SERACH:- <input name="getName" id="getName" type="text" value="Find emp name" >
<cfif isdefined('form.getName')>
<tr>
<cfloop startrow="1" endrow="qry" query="qry">
<cfoutput>Selected = #qry.getName#
<input name="Add" id="getNm" type="button" value="submit" onclick="document.getElementById('emp').value=document.getElementById('getName').value;">
</cfoutput>
</ cfloop>
tr>
</cfif>
</table>
</cfform>
Example:- there are 10 search results on the Child page, and I select the 8th result , still the Parent page is populated by the 1st result only. This is the case when I select everytime I select an search result.. When I click Submit button on the Child , only the First value of the Search result is being passed.
How to pass the exact selected search result, from the Child to the Parent page.
Please help.