Skip to main content
Inspiring
August 28, 2006
Question

Passing value from Child window to parent window

  • August 28, 2006
  • 2 replies
  • 1384 views
Hello,

When user click a link on parent page, i want to open a child window.

<a onclick="openWin()">Add Details</a>

In child window i got dynamic checkbox.

<cfoutput query="emp_q">
<tr>
<td>#Name#</td>
<td><input type="checkbox" name="emp_id" value="#emp_id#"></td>
</tr>
</cfoutput>

From child window, i want to pass dynamic checkbox value to parent window and display that value using inner html.

How can i do this?.

Thanks for help.
    This topic has been closed for replies.

    2 replies

    Inspiring
    August 28, 2006
    Yes, you are rigth. That's what happens when don't review what I'm answering.

    Regards
    Inspiring
    August 28, 2006
    When you click in the checbox or on a button to close the window, call a function with this JS inside :

    parent.document.getElementById('Tag_ID').innerHTML="the value I want to display"

    Regards
    Participating Frequently
    August 28, 2006
    Important correction:

    "parent.document.getElementById('Tag_ID').innerHTML"

    The 'parent' reference there is incorrect. 'parent' refers to a parent window from within a frameset. Within framesets you can reference parent/sibling frames using the "parent", "top", and "self" objects. You can also reference sibling/child frames by name/id.

    The relationships between actual "windows" is much different than "frames" for many reasons.

    The object you want to use when referring to the main window from a pop-up, is "opener". So replace "parent" above, with "opener".
    AdomacroAuthor
    Inspiring
    August 30, 2006
    Thanks Grizzly9279.

    Ya...i used
    window.opener.document.all.element_name.innerHTML

    works fine.


    When i pass a javascript varible as cf querystring. It is suppose to pass that varible to child window..right?. I am having some problem.

    var openWin = null;
    function opennewWin(){
    openWin = window.open(edit_page.cfm?listval=#listnames#','newWin','width=560,height=500,scrollbars=yes,menubar=no,status=no,location=no');
    }

    i am not about get listval value in child window. what i did wrong?.