How do I find an active window in my CF application?
Hi,
My CF website has 2 tabs (Search tab - reference_search.cfm and Reference tab - reference_input.cfm). When a user searches, it opens up a new window (Multiple Results - reference_search_results.cfm). From the Multiple Results window, a user may click one record in the list to go to the detail reference page (Reference tab). Up to this point, my apps is working fine. Now the user may click another record in the multiple results window (reference_search_results.cfm) to display this record in the Reference tab; however it does not work.
This is the code for the first record display, which works fine -
<a href="javascript:void(0);" onClick="alert(#ReferenceUnitId#);window.opener.parent.parent.document.getElementById('hdnRecordValue').value='#ReferenceUnitId#';window.opener.parent.parent.changeMenu('reference_tab','reference_input.cfm');">#ReferenceUnitId#</a>
The parent of reference_input.cfm is reference_home.cfm.
It does not work when the user clicks another record, #ReferenceUnitId#. The active tab at this point is the Reference tab but don't know how to get the location of the window. I tried the following codes inside the reference_search_results.cfm -
alert(window.opener.parent.location.href); //reference_search.cfm?referenceId=-1
alert(window.opener.parent.parent.location.href); //reference_home.cfm
alert(window.location.href);//reference_search_results.cfm
alert(window.parent.location.href); //reference_search_results.cfm?ReportType=Simple
alert(window.focus());//undefined
Thanks.
