Calling a function in child window from parent window

Hi,
How can I call a method in child window from parent window in adobe air using javascript. In the following example I need to call mytest() function in
child.html from parent.html file.
Thanks,
ASM
//parent.html
<HTML><HEAD>
<script>
var initOptions = new air.NativeWindowInitOptions();
initOptions.type = air.NativeWindowType.NORMAL;
initOptions.systemChrome = air.NativeWindowSystemChrome.STANDARD;
var bounds = new air.Rectangle(300, 300, 600, 500);
var html2 = air.HTMLLoader.createRootWindow(false, initOptions, false, bounds);
var urlReq2 = new air.URLRequest("child.html");
html2.load(urlReq2);
html2.stage.nativeWindow.activate();
html2.window.mytest();       //NOT WORKING
</script>
</HEAD><body></body></HTML> 
// child.html
<HTML><HEAD>
<script>
function mytest()
  air.trace("in child window");
</script>
</HEAD> <body></body></HTML>

I suspect your problem is that the child window hasn't been created by the time you call the function in the parent.Loading the content is an asynchronous processes -- AIR doesn't stop executing your code until the window has finished loading child.html. So, you will need to add an eventlistener to html2 and call the function from there:
html2.addEventListener( "complete", onChildLoaded );
function onChildLoaded( event )
     html2.window.mytest();

Similar Messages

  • 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 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 access objects in the Child Form from Parent form.

    I have a requirement in which I have to first open a Child Form from a Parent Form. Then I want to access objects in the Child Form from Parent form. For example, I want to insert a record into a block present in Child Form by executing statements from a trigger present in Parent Form.
    I cannot use object groups since I cannot write code into Child Form to first create object groups into Child Form.
    I have tried to achieved it using the following (working of my testcase) :
    1) Created two new Forms TESTFORM1.fmb (parent) and TESTFORM2.fmb (child).
    2) Created a block named BLK1 manually in TESTFORM1.
    3) Created two items in BLK1:
    1.PJC1 which is a text item.
    2.OPEN which is a push button.
    4) Created a new block using data block wizard for a table EMPLOYEE_S1. Created items corresponding to all columns present in EMPLOYEE_S1 table.
    5) In WHEN-NEW-FORM-INSTANCE trigger of TESTFORM1 set the first navigation block to BLK1. In BLK1 first navigable item is PJC1.
    6) In WHEN-NEW-ITEM-INSTANCE of PJC1, code has been written to automatically execute the WHEN-BUTTON-PRESSED trigger for the "Open" button.
    7) In WHEN-BUTTON-PRESSED trigger of OPEN item, TESTFORM2 is opened using the following statement :
    open_form(‘TESTFORM2',no_activate,no_session,SHARE_LIBRARY_DATA);
    Since its NO_ACTIVATE, the code flows without giving handle to TESTFORM2.
    8) After invoking OPEN_FORM, a GO_FORM(‘TESTFORM2’) is now called to set the focus to TESTFORM2
    PROBLEM AT HAND
    ===============
    After Step 8, I notice that it passes the focus to TESTFORM2, and statements after go_form (in Parent Form trigger) doesnot executes.
    I need go_form with no_activate, similar to open_form.
    Edited by: harishgupt on Oct 12, 2008 11:32 PM

    isn't it easier to find a solution without a second form? If you have a second window, then you can navigate and code whatever you want.
    If you must use a second form, then you can handle this with WHEN-WINDOW-ACTIVATED and meta-data, which you have to store in global variables... ( I can give you hints if the one-form-solution is no option for you )

  • Can a loaded SWF call a function that lives in the parent?

    I'm building a pretty simple Flash site in AS3. There is a
    main movie (main.swf) that simply loads different swfs via buttons
    on a main nav bar. The user clicks on a MC in "main.swf" and a
    function is called, loadMyContent("section1.swf"), is called and it
    animates in nicely. Other buttons use the same function, loading
    section2.swf, section3.swf, etc.
    I've defined how "loadMyContent()" works in the the main
    movie's document class file. It's all working fine when I just need
    to load content from a user action from the buttons that live in
    "main.swf". I want to call that same "loadContent" function from
    within "section1.swf" and have "main.swf" run it's "loadContent"
    fuction, but I can't seem to figure out how to make a child call a
    function that lives in the parent.
    Is there any way of having my child do this?
    I have a suspicion I may have to define that "loadContent"
    somewhere else, but I'm a little stumped now. I'm not really
    familiar with design patterns yet, although I want to get an
    understanding of them sometime soon. Can anyone offer some help
    with my immediate need or suggest a route to a solution?
    Thanks.

    kglad,
    Thank you very much! That worked perfectly. My section1 FLA
    is now compiling it's SWF without complaint.
    In case someone else is following this, the exact code I
    ended up using to cast "this.parent.parent" as a MovieClip is:
    MovieClip(this.parent.parent).loadMyContent("section2.swf");
    The discussion I think kglad is referencing is
    this
    discussion. If that's not it, just let me know. Again, kglad,
    thank you!

  • Spawning child program from parent concurrent program.

    Hi All,
    I am trying to spawn multiple child programs from Parent concurrent program, Parent concurrent program is having execution method as HOST.
    Here is how I designed it.
    1. Parent Concurrent program (Parent Conc program with execution method as HOST).
    2. Host file is abc.prog calls PLSQL package xyz.main.
    3. xyz.main has logic to launch multiple child programs - (Child Conc program with execution method as PLSQL stored proc) using fnd_request.submit_request utility.
    All the child programs are getting launched but are in INACTIVE/NOMANAGER state. Could you please let me know how to overcome this issue.
    Both Parent and child programs are added to standard concurrent manager. This issue is only coming when parent program as execution method as HOST if parent program execution method is PLSQL stored procedure then child programs are running fine..
    I also tired initializing apps in HOST file (abc.prog) before calling PLSQL package xyz.main.
    Thanks.
    Sham.

    hi,
    even i was facing the same issue. while submitting the child requests through fnd_request.submit_request i tried the following:
    FND_REQUEST.submit_request (
    application => 'Application Short Name',
    program => 'Program Executable Name',
    description => 'Program Description',
    start_time => NULL,
    sub_request => FALSE,
    argument1 => 'Input 1',
    argument2 => 'Input 2' );
    After this the Programs were submitted successfully.

  • How to close child windows when parent window closed in jsp

    how to close child windows when parent window closed in jsp
    becoz it can't be able to recognise it's parent
    with the whole application
    plz send me some sample code of it

    Hi, I have no idea how to do this is JSP.
    However createing a modal window (with javascript) would mean that the user can not use the parent window untill he closes the child window. However not sure if this is what you are searching.
    Otherwise you can detect the onClose (I think) and close the window from there.
    However both the above are JavaScript and not JSP.
    rwgards,
    sim085

  • Call a function inside a package from a stored procedure

    Hello:
    I am kind of new to the stored procedure. Does anyone know how to call a function inside a package from another stored procedure?
    I have a existing function (func_b) inside a package (pack_a) and it returns a cursor. I want to call this function from a stored procedure (proc_c) so that I use the data inside the cursor.
    can I do the following in proc_c:
    my_cursor1 SYS_REFCURSOR;
    begin
    my_cursor1 := exec pack_a.func_b
    end
    It will be very helpful if anyone can point me to any reading or example. Thank you very much for your information.

    guys:
    Thank you for your information so far. I need some more help here. I was able to run the function in my stored procedure. However, I was not able to print the result on the screen to view the cursor result, although I am using dbms_output.put_line statement inside my stored procedure.
    I use the following statement to execute my stored procedure on sql*plus. I can tell the stored procedure is executed successfully, but I did see anything printed:
    DECLARE TEMP VARCHAR2(100);
    BEGIN PROC_LAWS_CAD_NAME_SEARCH('LPD', 'TEST DEVICE ID', 'TEST LAST NAME', 'TEST FIRST NAME', 'F', '11112009', TEMP); END;
    I tried to use 'set serveroutput on' and got the following error:
    ERROR:
    ORA-06502: PL/SQL: numeric or value error: host bind array too small
    ORA-06512: at line 1
    I am kind of confused now. thank you for your help.
    Jack
    Here is my procedure:
    create or replace
    PROCEDURE PROC_SEARCH
    ( AGENCY_ID IN VARCHAR2,
    DEVICE_ID IN VARCHAR2,
    L_NAME IN VARCHAR2,
    F_NAME IN VARCHAR2,
    SEX IN VARCHAR2,
    DOB IN VARCHAR2,
    CAD_NAME_SCH_RESULT_STR OUT VARCHAR2)
    AS
    v_agy_id varchar2(10);
    v_device_id varchar2(20);
    v_l_name varchar2(25);
    v_f_name varchar2(15);
    v_sex varchar2(1);
    v_dob date;
    -- this cursor is going to be used to store a list of warrant matching
    -- name search criteria
    cad_srch_cursor sys_refcursor;
    objSrch SEARCH_RESULT_TEMP%ROWTYPE;
    BEGIN
    cad_srch_cursor := SEARCH_PKG.SEARCH('TESTING', 'TESTER', null, null,null, null, getPhonetic('TESTING'));
    LOOP
    FETCH cad_srch_cursor INTO objSrch;
    EXIT WHEN cad_srch_cursor%NOTFOUND;
    --insert into SEARCH_RESULT_TEMP (name_last) values (objSrch.name_last);
    CAD_NAME_SCH_RESULT_STR := objSrch.name_last;
    dbms_output.put_line('First:'||objSrch.name_first||':Last:'||objSrch.name_last||':Middle:'||objSrch.name_middle);
    end LOOP;
    END PROC_LAWS_SEARCH;
    -----------------------------------------

  • How to create child part from Parent Item - BLOW UP Master - Automatically

    Hi to All,
    Have any one defined this process?
    To create child part from Parent Item - BLOW UP Master - Automatically ie. we receive FG from customer which we need to blow up to its child part. In that case, FG should be consumed & child parts should be generated in stock.
    We tried with recursive, but the stock of FG was again generating with recursive.
    Ex. FG after receiving from customer in stock 1
    Child parts (with offtake 1) X1, X2, X3 in stock zero.
    After processing, FG stock should be zero & X1, X2, X3 = 1.
    Regards
    Nitin

    Create a BOM for one of the "child" parts that has the "FG from customer" as a component and all the other child parts are negative quantity components (by products).
    To make it simple have all the components backflushed and auto goods receipt the child in the BOM header.  Create a production order, then process the confirmation (this will auto goods receipt the 1st child, consume by backflush the "FG from customer" and put the other child parts into stock as by products.
    You will need to get your material prices correct first so that there is minimal variance in the production order.

  • 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

  • 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.

  • Remove Child Window from Parent using WIN API

    Hello all,
    I am using User32.dll to make a parent-child relationship between two VIs. I use SetParent function, and pass the handle of parent VI and child VI to this function. Now, after this relationship has been established, I want to remove the child window from the parent and use it as a independent VI using WIN API. Can anyone help me on this?
    Thanks in advance!
    Fragger Fox!
    -FraggerFox!
    Certified LabVIEW Architect, Certified TestStand Developer
    "What you think today is what you live tomorrow"
    Solved!
    Go to Solution.

    You should be able to set a NULL handle to undo the parent-child relationship and make the child window again a normal top level window. Setting the desktop as parent is probably not the same as being a top level window.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • 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;
    }

  • Sending TABLE data in child window to parent window

    My question is as follows:
    I have a JSP with a parent window, which opens a pop-up window.
    In the pop-window there is a <TABLE> tag defined with a number
    of <TD> definitions referencing columns of data from a database table.
    There is also a 'select' button next to each row displayed.
    On pressing the 'select' button I want the data to go back to the fields
    in the parent window.
    I am successfully displaying the data in the pop-up window
    I have used the DOM model in the past and for other elements within this JSP - i.e. drop down lists, sending data back to the parent window works fine, but I'm not sure of the syntax for referencing the TABLE items within the DOM model to send back to the parent window.
    Any help on this would be very much appreciated.
    Many Thanks
    Chris

    Well I've looked and I can't find anything wrong with it, but then I wrote it. I've included it as follows:
    <%@page contentType="text/html"%>
    <html>
    <head>
    <SCRIPT language=JavaScript>
    function send_back(eventHandle)
    if (opener == null) {
    alert("\n Calling Window is no longer present. Will now close this window\n");
    window.close();
    else
    if (eventHandle == "returnRow") {
    <%-- Significant code below with the first statement referencing--%>
    form name and item name and its value --%>
    opener.document.produceTrans.studentID.value =
    document.personLOV.personID.value;
    <%-- statement below works so no that variable is correct-value --%>
    <%-- part is wrong --%>
    <%-- opener.document.produceTrans.studentID.value = "290000"; --%>
    </SCRIPT>
    <title>Person List
    </title>
    </head>
    <%-- If the focus switches to the calling window this called window is closed
    <BODY onBlur="window.close()"> --%>
    <BODY>
    <jsp:useBean id="personV" scope= "request" class="mypackage.PersonBean"/>
    <jsp:setProperty name="personV" property="personName" />
    <%-- Significant code below 1 with form name = personLOV --%>
    <form name=personLOV METHOD="POST" action="transcript-control-servlet?Action=personList">
    <TABLE >
    <tr>
    <td><input type='text' size=32 name="personName"> </td>
    <td>
    <input type="submit" name=personSearch value="Find Person">
    </td>
    </tr>
    </TABLE>
    <br>
    <div style="width:480px; height:170px; overflow: auto;">
    <TABLE border="1" cellspacing="1">
    <tr>
    <%
    Vector personVector = new Vector();
    try {
    personVector = (Vector)request.getAttribute("listPerson");
    for (Enumeration e = personVector.elements();
    e.hasMoreElements();) {
    personV = (mypackage.PersonBean)e.nextElement();
    //Significant code below 2 with persID setup
    String persID = personV.getPersonID();
    %>
    <tr>
    <%-- Significant code below 3 with hidden field set to persID --%>
    <%-- and name=personID --%>
    <td><input type="hidden" name=personID value='<%=persID%>'></td>
    </tr>
    <tr>
    <td><input type="button" name=SelectPerson value="Select"
    onClick=send_back("returnRow")> </td>
    <td><%= personV.getPersonID() %></td>
    <td><%= personV.getPersonLastName() %></td>
    <td><%= personV.getPersonFirstName() %></td>
    <td><%= personV.getPersonBirthDate() %></td>
    </tr>
    <% } }
    catch (NullPointerException ce) {
    System.out.println("No records in list ");
    %>
    It is very straightforward and I believe I am referencing the correct form name/item name in the correct manner.
    If I'm not then please tell me why not and how to fix it.
    Thanks
    Chris

  • Update cfdiv in Parent Window from popup window

    I need help trying to update a cfdiv in the parent window
    from a popup window.
    The parent window displays a color (red by default)
    The popup gives you a radio selection which would let you
    select a different color.
    I need to have this submit button update the cfdiv called
    "main" in the parent window by lby displaying the corresponding
    color AND I want this window to hide.

    <!--- POPUP.CFM --->
    <cfif NOT structkeyexists(form, 'color')>
    <cfform action="popUp.cfm" method="post" name="form1">
    <cfinput type="radio" name="color" value="red"
    required="yes">Red
    <cfinput type="radio" name="color" value="blue"
    required="yes">Blue
    <cfinput type="radio" name="color" value="green"
    required="yes">Green
    <br />
    <cfinput type="submit" name="submit" value="submit">
    </cfform>
    <cfelse>
    <script type="text/javascript">
    updateColor(<cfoutput>'#form.color#'</cfoutput>);
    </script>
    </cfif>
    <!--- MAIN PAGE --->
    <!--- Add this js function to the HEAD section of the
    page: --->
    <script type="text/javascript">
    updateColor = function(color){
    document.getElementById('main').innerHTML = color;
    ColdFusion.Window.hide('mywindow');
    </script>
    hth
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

Maybe you are looking for

  • ASAP Question and Answers Database for Retail

    Hi experts, Does anyone have a ASAP Question an Answers Database for Retail? Thanks in advance, SN

  • Add a Column to a Report

    Hello, How do I add a column to a Report after it has been created? I cannot find a way to do it readily in the "Report Column Attributes" as I thought it might be the more rational place to put such a time. Nor is there any information in the PDF Ma

  • Connecting third party motor to p7000 tools

    Hi, I have a vexta PK245-011AA stepper motor and I'm trying to control it with a P70350 drive via P7000 tools software. When I enter the specification of the motor in the "Stepper Motor/Motor File Editor" menu and select my motor configuration (see a

  • I can't buy any music on my MacBook in iTunes

    When I try to purchase music in iTunes I am prompted for my password. Once I enter it correctly, the prompt disappears and then reappears right after with my password not filled in. I enter it correctly each time and each time it just keeps prompting

  • Does new Thread(this) work for a Frame class?

    package MThreads; import java.awt.*; import java.awt.event.*; import java.lang.*; public class ThreadFrame extends Frame implements Runnable {   Button btnNew = new Button("New"); Thread aThread = null; public ThreadFrame() { /* nothing in here */} p