locked
Parent field from child window RRS feed

  • Question

  • Hello,
    I'd like to ask If i can read DataValue of parent's field from child window. I've an entity, and after clicking "Add existing..." a new window appears. I'd like to be able to access entity's field fom that popup window. Is is possible??
    Saturday, October 25, 2008 9:35 PM

Answers

  • Generally speaking: If the popup window is opened using the window.open function then the child can refer the parent using the opener object.

     

    Popup code example:

    Code Snippet

     

    alert( opener.document.getElementById( “new_customattribute” ).DataValue );

     

     

    If the popup is a dialog then the only way you can refer to the parent is by passing the parent window to the popup as an argument.

     

    This must be coded from the parent side e.g.

    Code Snippet

     

    window.showModalDialog( “url” , window /*parent*/ , “features” );

     

     

    Adi

     

    Sunday, October 26, 2008 1:35 AM

All replies

  • Generally speaking: If the popup window is opened using the window.open function then the child can refer the parent using the opener object.

     

    Popup code example:

    Code Snippet

     

    alert( opener.document.getElementById( “new_customattribute” ).DataValue );

     

     

    If the popup is a dialog then the only way you can refer to the parent is by passing the parent window to the popup as an argument.

     

    This must be coded from the parent side e.g.

    Code Snippet

     

    window.showModalDialog( “url” , window /*parent*/ , “features” );

     

     

    Adi

     

    Sunday, October 26, 2008 1:35 AM
  • Aha,
    ok and if I've a dialog, and I open that dialog by clicking "Add existing....." , how can I change the code when I click "Add  existing"?? I mean it's built into crm and I don't know how I can change the code which is executed when "Add existing " button is clicked.
    Sunday, October 26, 2008 8:00 AM