Communicating from child window to parent window

I'm been trying to communicate a child page with a parent page using window.opener, but I can't make it work. This is an example of what I've been working on (from child to parent). Any idea?
<$-HTML>
<$-HEAD>
<$-TITLE>
Ventana hija
<$-/TITLE>
<$-SCRIPT Language="javascript">
function cerrar() {
     alert(window.opener.document.url())
     window.opener.frmPadre.field1.Value = document.frmHijo.field1.value;
     window.opener.frmPadre.field2.Value = document.frmHijo.field2.value;
     window.opener.frmPadre.field3.Value = document.frmHijo.field3.value;
     document.frmHijo.valor.value = document.frmHijo.field1.value;
     window.opener.frmPadre.btnSubmit.focus();
<$-/script>
<$-/HEAD>
<$-BODY>
<$-form name = frmHijo>
<$-input type = text name = field1><$-br>
<$-input type = text name = field2><$-br>
<$-input type = text name = field3>
<$-input type = button name = btnSubmit Value = "DEVOLVER" onClick = cerrar()>
<$-/form>
<$-/BODY><$-/HTML>
The parent window hast a form name frmPadre with those 3 fields.

Javascript is not java, but here are a couple of tips for debugging:
You can use the browser address bar to alert stuff
ie : put this into the address bar of your browser and see what happens: javascript:alert("Hello world")
I would recommend you progress like this - slowly building up the link until you find where you go wrong.
In this case, I think you missed out a "document"
javascript:alert(window.opener)
javascript:alert(window.opener.frmPadre)
javascript:alert(window.opener.document.frmPadre)
javascript:alert(window.opener.frmPadre.field1)
Also just as a tip, cross browser scripting is a lot easier to maintain if you limit your self to calling FUNCTIONS in other windows.
ie rather than setting the values in the other windows textfields, call a function (with parameters) which does it.
eg in this case it might be:
window.opener.setPadreFields(document.frmHijo.field1.value, document.frmHijo.field2.value, document.frmHijo.field3.value)
The function would take the parameters and put them in the appropriate place on the form.
Doing it this way decouples the pages a little - you only interact with the other page via the function (single point of entry) and if you modify the page in the future (eg change the name of a field) it is much easier to find everywhere you need to do this.
Hope this helps,
evnafets

Similar Messages

  • How to parse parameter from child window to parent window in JSP

    I have two JSP i.e. course1.jsp and course2.jsp. I would want to find out how I could parse the parameter/value from child window to the parent window when the child window get closed.
    What I am trying to do is actually a file upload process. The child windows will open for user to upload the file, and when close, the file name will be parse into the parent form for database update. Is this something possible at all? or is there any other better approaches.
    Thank you.
    These are the two files:
    --------course1.jsp ------------
    Attach File <p>
    <FORM name="courseForm" action="course2.jsp" method="post" enctype="multipart/form-data">
    <TABLE cellSpacing=1 cellPadding=3 border=0 WIDTH=500>
    <TR >
    <TD>
    <input type="text" NAME="f_file_name" size="30" VALUE="this value should be taken from child windows">
    get file name
    <p>
         <INPUT class="buttons" TYPE="submit" NAME="submit" VALUE="Submit">
    </TD>
    </TR>
    </TABLE>
    </FORM>
    ---- course2.jsp -------
    <%
    String filename = "this is the string needs to go back to parent windows when I click on close";
    %>
    <p>
    close

    In course2.jsp, you have to write some javascript code to reload the parent window document to reload the document with an added parameter. But, instead of doing this, you can also do simple thing; in course2.jsp, you can reference course1.jsp controls via javascript object, "parent". On closing event of course2, you can write:
    parent.courseForm.f_file_name.text = '<%=filename%>' ;
    window.close() ;
    But for this to work, you must open your course2.jsp document thru window.open() function instead of simple hyper link (as you did thru ).
    So, modify the hyperlink line like below:
    get file name
    Hope it helps.

  • Problem in Passing the value from child window to Parent window.

    Hi Frenz,
    I have a requirement like this. i have to pass a value from child window to parent window to one test field. That text field is not a normal text field.
    It was created like the following as SQL query.
    select
    ''LNo,
    apex_item.text(25,'',0,15,
    'style="width:100px;" onblur="javascript:showUpsell(this.value);" onkeypress="javascript:validateKeyPress(event,this.value,this.id);" onkeyup="javascript:this.value=this.value.toUpperCase();" id="P37_ITEMNO"') ItemNo
    Now i want to pass a value to the Item no from child window.
    i wrote the java script like this,
    opener.document.forms[0].f25.value="100";
    It was not working..Any suggestions for that..
    Thanks in advance

    Dear Baaju,
    How do you redirect your control from Child to Parent window.
    If you use a button to do this, then you can set this value in the branching of page.
    Rana

  • How to pass a data from child window to parent window

    Hi,
    I have a jsp page with two hidden fields and a button, On clicking the button a popup will come out. There are two combobox in the popup and a search button. After putting a value in the comboboxes,if I click the search button, I need the datas of the combobox to pass to the parent's hidden fields then I need to do a data base search with that values of hidden fields and display the result in the parent page.
    I could I solve this problem, Please help, Its urgent.
    Thanks and Regards
    Rajib Sharma

    I think that you can use the JavaScipt as follow to pass a data from child window to parent window
    <HEAD>
    <script>
    function passData(){
    opener.form1.test1.value=form2.test2.value; //pass the value of test2 to the parent's test1
    window.close();
    </script>
    </HEAD>
    <BODY>
    <form name=form2>
    <input name=test2 type=text>
    <input type=button onclick="passData()" value=CLOSE>
    </form>
    </BODY>

  • Problem: Passing the business data from Child DC to Parent DC

    HI Dear All,
    I    developed two DC,s Parent and Child DC,i am able to pass the data from Parent DC to CHild DC,when i am trying to pass the data from Child DC to Parent DC i am unable to map the context attributes. Is it possible to pass the data from Child DC to Parent DC.
    Thanks in advance,

    What I wrote earlier:
    Yes you can acheive it by doing a flip. ie, in this case the present Parent DC will become Child DC and present Child DC will become Parent DC. Now you can share the context atrributes in reverse way (ie, you can access the context attributes of current Parent DC in current Child DC).
    Sorry Parameshwari. As Anand suggested, It will give an error called Cycle in component usage definitions, if you are doing the procedure what I suggested.
    In that case only you can do only one thing , you should maintain the requried context attribute in child DC and you can use it in parent DC.
    Child DC using Parent DC's context attribute is not possible.
    Regards,
    Jithin

  • Accessing variables from Child window from the parent window

    Hi All,
    I am in the process of integration of payment gateway, here I am opening payment gateway page as a new window, and after payment is done then I need access one variable which is hidden variable ...any ideas

    Have a hidden field/js variable in the parent page. Add a Javascript function in parent page which would take a value as parameter and set in the parent page hidden field/js variable. In the child window, you can invoke the method from script block as window.opener.setValue(document.getElementById('CHILD_WINDOW_HIDDEN_FIELD_ID').value)
    For Javascript related questions, please visit Javascript forums.

  • Move data from Child window textbox to Parent window Mainwindow WPF

    I'm trying to take what's in a textbox in the child window to the textbox in the Parent window and close the child window...? any links or  a code example to help please
    Thank you in advance

    Hi
    Create a Main window with a button and a child window with a text box in it and try to use this code in the main window
    namespace WpfApplication
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    public MainWindow()
    InitializeComponent();
    ChildWindow childWindow;
    string CaptureMessageFormChildWindow;
    private void button1_Click(object sender, RoutedEventArgs e)
    childWindow = new ChildWindow();
    childWindow.Show();
    childWindow.Closed += (s, args) => MessageBox.Show(childWindow.textBox1.Text);
    CaptureMessageFormChildWindow = childWindow.textBox1.Text;
    //Now you can use the data captured form the child windows
    The complexity resides in the simplicity Follow me at: http://smartssolutions.blogspot.com

  • Window.opener  property from child window to parent window

    Hi
    When communicating between the child (popup) window to the parent window works fine as long as we pass the static reference to the window.opener
    Example :
    Main Page
    form name = staticform
    input name = col1
    Popup Page
    javascript :
    window.opener.staticform.col1.value = some value
    How can I use a dynamic reference for the staticform.col1 in the window.opener property to post the value back to the parent window ?
    thanks for the help
    sarma

    Actually, I think tolmank's would work... I've done basically the same thing before, but more like this (if it's generic, it's a good idea to have checks for the things being in existance). This is something I used in a generic color chooser I wrote in Javascript. Had multiple fields in one form using it for selecting different foreground/background colors.
    <%
    String form = request.getParameter("form");
    String fgfield = request.getParameter("fgfield");
    String bgfield = request.getParameter("bgfield");
    %>
    vfnSet = function() {
       if(typeof(window.opener) == 'undefined' || window.opener == null) {
          return;
       if(typeof(window.opener.document.forms['<%= form %>']) == 'undefined') {
          return;
       var oForm = window.opener.document.forms['<%= form %>'];
       if(typeof(oForm.<%= fgfield %>) == 'undefined') {
          return;
       if(typeof(oForm.<%= bgfield %>) == 'undefined') {
          return;
       oForm.<%= fgfield %>.value = document.forms['colorform'].foreground.value;
       oForm.<%= bgfield %>.value = document.forms['colorform'].background.value;
    }

  • How to submit the parent window from child window

    Hi,
    I am looking out for a solution. I have a main JSP page and on clicking a button in the page a pop up window will be displayed, which is too a JSP page. Finally i should submit both Popup window JSP page and the parent window JSP page, when clicking the button in pop up window. Can anyone come out with some possible solutions.

    Hi
    Please go through this.. check thomas reply
    Re: Close Main Window directly on action on Pop up window
    also check this..
    how to close main window on click of a button on popup window
    cheers,
    Kris.
    Edited by: kissnas on May 12, 2011 5:06 PM

  • Passing Dynamic Loop Data From Child Page To Parent

    Hi All,
         I'm trying to create something where when a user clicks a link on the main page, javascript opens a new window which querys a database and displays the results.  The user then selects the result they want via a form button or url (doesn't matter which) from the child page, which sends a value to fill in a form field on the parent page.  Sounds simple, but I can't figure out how to get the information back to the parent page from the dynamic form in the child.  I get a value of Undefined in the form field on the parent page.  I think its because I'm using the same name for each button with a different value, and javascript doesn't like that.  I'm not really that good with JS, which I suspect is why I can't get it.  I'll post my code below, and any help is greatly appreciated.  Thank you!
    Parent Page:
    <cfform name="RRForm" action="Blah.cfm" method="POST">
    <table>
        <tr>
            <th align="right">Start Date:</th>
            <td><cfinput type="text" name="StartDate" value="#sdate#" validate="date" message="Please enter a valid START DATE" maxlength="10" size="10"></td>
        </tr>
        <tr>
            <td><br></td>
        </tr>
        <tr>
            <th align="right">End Date:</th>
            <td><cfinput type="text" name="EndDate" value="#edate#" validate="date" message="Please enter a valid END DATE" maxlength="10" size="10"></td>
        </tr>
        <tr>
            <td><br></td>
        </tr>
        <tr>
            <th align="right">Client Number(s):</th>
            <td><input type="text" name="clientnums" size="20" maxlength="60" value=""> <font style="font-size:8pt">(Comma Separated)</font>   <a href="javascript:void(0);" OnClick="window.open('http://192.168.0.189/BlahList.cfm','ClientList','toolbar=0,menubar=0,resizable=0,location= 0,status=0,scrollbars=1,height=300,width=500')">Client List</a></td>
        </tr>
        <tr>
            <td><br></td>
        </tr>
        <tr>
            <th align="right" valign="top">Precision Level:</th>
            <td><cfinput type="Radio" name="PrecisionLevel" value="Y" checked="No">Years<br><cfinput type="Radio" name="PrecisionLevel" value="M" checked="Yes">Months<br><cfinput type="Radio" name="PrecisionLevel" value="W" checked="No">Weeks<br><cfinput type="Radio" name="PrecisionLevel" value="D" checked="No">Days</td>
        </tr>
        <tr>
            <td><br></td>
        </tr>
        <tr>
            <th align="right">Display Zero:</th>
            <td><cfinput type="Checkbox" name="DisplayZero" value="1" checked="Yes"></td>
        </tr>
    </table>
    <br>
    <br>
    <input type="submit" name="RunReport" value="Run Report">
    </cfform>
    Child Page:
    <cfquery name="GetClients" datasource="BlahOLE">
        SELECT clientno,name,inactive
        FROM clients
        ORDER BY #sortcrit# ASC
    </cfquery>
    <html>
    <head>
        <script type="text/javascript">
          function SendInfo(){
            opener.document.RRForm.clientnums.value = document.CForm.PassData.value;
            window.close();
        </script>
        <title>Client List</title>
        <style>
        td{font-size:10pt;}
        </style>
    </head>
    <body bgcolor="black" text="white" link="aqua" alink="red" vlink="aqua">
    <cfoutput>
    <form name="CForm" method="post">
    <table>
        <tr>
            <th><a href="http://192.168.0.189/BlahList.cfm?sortby=CNO">Client ##<hr></a></th>
            <th>   </th>
            <th><a href="http://192.168.0.189/BlahList.cfm?sortby=CNAME">Client Name<hr></a></th>
            <th>   </th>
            <th>Status<hr></th>
        </tr>
        <cfloop query="GetClients">
        <cfset cno=Trim(ClientNo)>
        <tr>
            <td><input type="Button" name="PassData" value="#cno#" style="width:50" onclick="SendInfo()"></td>
            <td></td>
            <td>#name#</td>
            <td></td>
            <td><cfif inactive is "FALSE"><font color="##33ff33">ACTIVE</font><cfelse><font colore="Silver">INACTIVE</font></cfif></td>
        </tr>
        <tr>
            <td colspan="5"><hr></td>
        </tr>
        </cfloop>
    </table>
    </form>
    </cfoutput>
    </body>
    </html>

    Dan, that was exactly it.  Thank you so much for the help!   I'm displaying the corrected code changes below for future reference by others.
    <script type="text/javascript">
          function SendInfo(incomingValue){
          opener.document.RRForm.clientnums.value = incomingValue;
          window.close();
    </script>
    AND
    <input type="Button" name="PassData" value="#cno#" style="width:50" onclick="SendInfo(#cno#)">

  • Time Sync from Child domain to Parent doamin

    Now the time in our child domain is fast 2 Mins than parent domain, how to sync the time by what command ?

    Hi,
    By default, the PDC Emulator of the Forest Root Domain is considered as the best time source in an Active Directory forest. Other domain controllers
    in the Forest Root Domain use it for time synchronization while domain controllers in child domains use the PDC Emulator or any domain controller from parent domain for time synchronization. Member servers and Workstation use domain controllers in their domain
    for time synchronization. With this hierarchy, we can maintain a reliable time synchronization system that allows avoiding Kerberos failure issues in an Active Directory domain. This configuration is by default in an Active Directory forest and does not need
    to be changed.
    As mentioned by SH.Hashemi, we can run command
    w32tm\resync to resynchronize the clock as soon as possible, disregarding all accumulated error statistics.
    Regarding time synchronization in active directory, the following articles can be referred to for more information.
    Time Synchronization in Active Directory Forests
    https://social.technet.microsoft.com/wiki/contents/articles/18573.time-synchronization-in-active-directory-forests.aspx
    How the Windows Time Service Works
    http://technet.microsoft.com/en-us/library/cc773013(v=ws.10).aspx
    W32tm
    http://technet.microsoft.com/en-us/library/bb491016.aspx
    Best regards,
    Frank Shen

  • Contextual event in reverse direction ( from child TF to parent view )

    Hi ,
    It seems all example of Contextual events talk about mirroring input value from Parent page to Child TF running in a region and there are numerous examples out there.
    What I wanted to accomplish was that an lov in a child TF triggers a contextual event and the parent TF takes the selected list of values. It needs to conduct a search based on these values and than mark the rows in a (tree)table.
    What has succeeded is almost all aspects of this. I can fire the event and receive it successfully. But the problem is the the backingBean class that I create via EL is not binded to my parent pages components. The treetable component returns null.
    My handler code (the handler code from the bean which you use to create the data control to listen to the cntxtual event) is almost 1:1 to as the code from the book "Oracle Fusion Developer Guide: Building Rich Internet Applications with Oracle ADF Business Components and Oracle ADF Faces", Chapter 6, page 210.
    public void receiveEvent(
    DCBindingContainerValueChangeEvent incomingPayload){
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    Application app = fctx.getApplication();
    ExpressionFactory exprFactory = app.getExpressionFactory();
    ValueExpression valExpr = exprFactory.createValueExpression(
    elctx,
    //reference the managed bean that holds the mirror value
    //property displayed in the input text field
    "#{backingBeanScope.ConsumerBackingBean}",
    Object.class);
    ConsumerBackingBean consumer = null;
    consumer = (ConsumerBackingBean)valExpr.getValue(elctx);
    //get the changed attribute value from the contextual event
    //payload
    String newValue = (String)incomingPayload.getNewValue();
    //set the new value to the backing bean property that is
    //referenced by the input text field in View 3
    consumer.setMirrorValue(newValue);
    AdfFacesContext adffacesContext = null;
    adffacesContext = AdfFacesContext.getCurrentInstance();
    //partially update the text field to display the new value
    adffacesContext.addPartialTarget(consumer.getMirrorTxt());
    The #{backingBeanScope.ConsumerBackingBean} evaluates in my case to fine. But every component I should see as binding in the bean is null.
    Since the handler is declared in the pageDef of this parent page Fragment, i assumed the last bit about it being able to get to the backing bean and hence to my components should also be possible.
    If I cant refresh my components than I dont see the use of the contextual frameworks for me.

    You should find this post useful: http://flexponential.com/2010/12/05/saving-scroll-position-between-views-in-a-mobile-flex- application/
    It demonstrates one way of saving and restoring data when pushing and popping a view.

  • Passing SolveRegular Expression Variable from Child Script to Parent Script

    I am having two scripts; Parent and Child, calling the child script user defined method in parent script.
    I need to pass a child script's SolveRegularExpression variable present in the user defined method to the parent script's next StepGroup, just after invoking the Custom method in Child Script.
    Any help is much appreciated.
    Regards

    Got the solution.
    We have to use the eval() function to evaluate the variable with a value from an OpenScript transform variable.
    Thanks

  • Transfr dates from child network to parent network(using subnetwork functio

    Hi All,
    i have created 2 separate projects one is parent with 1 network activity assigned to root wbs element and other is child project with several network activitites. By using sub network function i have assigned the parent project network activity to the child level project network in Sub netorwk field.
    How can i roll up the child projects network dates to parents project network.
    Regrds
    saqib usman

    i have already done sheduling but basic dates are not updating across networks.
    how can i scedule two networks in different project at one time.

  • How to call column of parent's different child from child of same parent in

    Hi Guys,
    I am not able to get same parent's but different child column in RTF, I tried it by using ../../<diff_child_tag>/column_name, but it is not working... Can anybody help me in that.
    Thanks,
    Nidhi

    you can have a view accessor for your child entity.. using the sort by creation_date query.
    in doDML(). check if the operation is UPDATE.. if so then have a logic there to see if the child is the first row in the view accessor result..
    if not.. then raise an error..
    psuedo code will be like
    doDML(operation op){
    if(op = DML_UPDATE){
    ViewObject va_creationDate = getVACreationDateSorted().getViewobject();
          RowSet rs = va_creationDate.getRowSet();
          while(rs.hasNext()){
            Row r = rs.first();
                if(r.getAttribute("Creation_Date").equals(CurrentDate)){
                //update
              else{
                //raise errro
    }

Maybe you are looking for

  • Looking for the best app that has a timer for self portraits for my Iphone 5

    I am looking for recommendations for the best app for my IPhone 5. An app that allows you to take your own picture without having to hold the phone. Something with a timer?

  • Long Text of a PO

    hai all, Can anyone please let me know, in which table exactly the Long Text of a Purchase Document is going to be stored? Thanks in advance, Regards, HKM

  • Delete query taking more than 2 hours

    Hi I have table1 with more than 20 million rows.I am trying to delete some rows based on conditions.I have written a query to delete the rows.Butit is taking almost 2 hours.Is there any other way to achieve this? DEL FROM TABLE1 WHERE ID=100 AND SRCE

  • Bw roles

    hi all, I have a reuqirement where in I need to connect the info providers names (cubes) with the roles in BW and then roles to user ids, that how I can figure out which user uses which report ..and mail them when load breaks.Can anyone give me any b

  • Unable to Connect to Oracle 10gR1 database from JDeveloper 11g using OCI JD

    We are migrating our application from OC4J to Weblogic server. As a part, I am trying to create a database connection in JDeveloper 11g (11.1.1.3.0 - Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660) to Oracle 10gR1 database. Previously I had Orac