www.webdeveloper.com
Results 1 to 3 of 3

Thread: Passing data from Child to parent

  1. #1
    Join Date
    Jun 2012
    Posts
    58

    Passing data from Child to parent

    This seems to be a common problem. I have posted before but didn't get a resolution so I am going to post again but a little differently.

    What I need to do is pass a value from a child popup window to the parent window. When I get the value back on the parent window I can hide or expose a button based on the value passed back.

    Parent Code:
    Code:
    <body style="background-image: none; background-color: White" class="floormgr" bgcolor="#FFFFFF" text="#000000">
    <input type="hidden" name="publish" value="" />
    Child Code:
    Code:
    <script type="text/javascript">
    function onOK()
    {
    	if(formOpenLayout.layoutname.value == '' && formOpenLayout.layoutname.value != null)
    	{
    		alert('You must select a layout.');
    		formOpenLayout.layoutname.focus();
    		return;
    	}
    	else {
    	    var sLayout = formOpenLayout.layoutname.options[formOpenLayout.layoutname.selectedIndex].text;
    	    //alert("Name: " + sLayout + ", Status: " + sLayout.indexOf('UNPUB'));
    	    if (sLayout.indexOf('UNPUB') > 0) {
    	        self.opener.document.getElementsByName('publish').item = "unpublished";
    	    }
    	    
    		window.returnValue = formOpenLayout.layoutname.value;
    		window.close();
    	}
    }
    I get an error that "self.opener.document is not an object".

    Any help would be appreciated.
    Thanks.

  2. #2
    Join Date
    Aug 2012
    Posts
    13
    Did you try without the self. in front of it?

    opener.document.getElementsByName('publish').item = "unpublished";

  3. #3
    Join Date
    Jun 2012
    Posts
    58
    I did try without the self. in frontof the code and I still get the error message "opener.document is null or not an object".

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles