Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
When a user clicks on a link for the second time, does the content of Reference tab change to the correct content? Is it just an issue with the tab not re-focusing? If that is the case, you could try the following code to re-focus that tab...
Add this to the body of reference_input.cfm.
onLoad="self.focus();"
Another option would be to open a modal window from the reference_search_results.cfm page, like a fancybox window.