我有父頁面和子彈出窗口頁面(empW.cfm)。子頁面具有搜索字段,用於搜索並顯示結果。我必須從三個子頁面中選擇一個搜索結果並將其填充到父頁面。將錯誤的值從子頁面傳遞到父頁面。
我無法將正確的選定值從Child傳遞給Parent頁面。
父頁面: -
<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>
兒童/窗口頁面: -
<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>
例子: - 有兒童第10個的搜索結果,而我選擇了8號的結果,仍然是父頁面僅由第一個結果填充。我每次選擇搜索結果時都會選擇這種情況。當我點擊子項上的提交按鈕時,只有搜索結果的第一個值被傳遞。
如何將確切的選定搜索結果從子頁面傳遞到父頁面。
」現在你最終會得到多個具有相同ID的getName字段。「 – Fransis 2010-10-12 19:24:23
是的,這就是我現在正在得到的傑森,因爲我只想傳遞選定的值。 – Fransis 2010-10-12 19:25:09
我已更正js /「src」併爲getName具有唯一值。 stil – Fransis 2010-10-12 19:27:59