Alpha Video Training
Results 1 to 4 of 4

Thread: Close A5W page from JavaScript ?!

  1. #1
    Member
    Real Name
    Fred Chan
    Join Date
    May 2012
    Posts
    72

    Default Close A5W page from JavaScript ?!

    Dear Experts,

    I have a Dialog to call a A5W Page from a button, and want to close the popup Windows When user press a Button from the popup Windows

    function showSignature() {
    pathdata.textContent = svg.getSignature();
    a5_AJAX_Callback('sign.ajax.a5w','action=sign&signature=' + pathdata.textContent);
    closeParentA5Window(this); <------ Can't Work
    this.close() ; < ----- Can't work
    Window.close() ; < ----- Can't Work

    }

    Which command that I can close the A5W page and return to the calling dialog ?

    Thanks

  2. #2
    "Certified" Alphaholic
    Real Name
    Chris Tappan
    Join Date
    Jun 2009
    Location
    Marietta, GA
    Posts
    1,303

    Default Re: Close A5W page from JavaScript ?!

    Recently started using this method myself from the v11 release notes:

    How to Close a Pop-up Window when the Window Contains an .A5W Page - A common use case when a pop-up window contains a Dialog or Grid is for an event handler in the Dialog or Grid to execute some Javascript to close the pop-up window. For example, you might want to close the pop-up window automatically after the Grid has been submitted.

    This is easily done using the following techinque:

    1. Give the window some arbitrary 'id' by putting a span tag in the window title. For example
    <span id="MyWindow1">My Window Title</span>

    2. Call this Javascript in the event handler
    closeParentA5Window('MyWindow1');

    A problem arises however if the window contains a .a5w page (which in turn contains the Grid or Dialog component). This is because .a5w pages run in an IFrame. So the window you want to close is not in the same namespace as the Grid or Dialog. To solve this problem, change the Javascript that closes the window to this:

    window.parent['closeParentA5Window']('MyWindow1');

    This executes the function in the context of the IFrame parent's namespace, and the window will close.

  3. #3
    Member
    Real Name
    Fred Chan
    Join Date
    May 2012
    Posts
    72

    Default Re: Close A5W page from JavaScript ?!

    changed ... but still can't work

    thanks



    <!doctype html>
    <title><span id="MyWindow1">My Window Title</span></title>
    <title>Signature</title>
    <style>
    body { font-family: Helvetica, sans-serif }
    iframe { width: 600px; height: 200px; border: 0 }
    #pathdata { font-family: monospace; background: #ddd; padding: 8px; margin: 1em }
    </style>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <script type="text/javascript" src="javascript/a5.js"></script></head>


    <body>

    <p>
    <td>&nbsp;&nbsp;Please sign on the dotted line below<br>&nbsp;
    <iframe src="signature.svg"></iframe>

    <div>
    <button onclick=showSignature()>Confirm</button>
    <button onclick=clearSignature()>Clear</button>
    <div id=pathdata></div>
    </div>
    </td>
    <p></p><script>
    var svg = document.getElementsByTagName('iframe')[0].contentWindow;
    var pathdata = document.getElementById('pathdata');


    function showSignature() {
    pathdata.textContent = svg.getSignature();
    a5_AJAX_Callback('sign.ajax.a5w','action=sign&signature=' + pathdata.textContent);
    window.parent['closeParentA5Window']('MyWindow1');

    }

    function clearSignature() {
    svg.clearSignature();
    pathdata.textContent = '';
    }
    </script>

    </body>
    </html>

  4. #4
    Member
    Real Name
    Omar Garcia
    Join Date
    Jun 2006
    Location
    Alamo, Texas
    Posts
    582

    Default Re: Close A5W page from JavaScript ?!

    Found this http://msgboard.alphasoftware.com/al...dal-popup-grid

    Worked for me. Scroll to the bottom; You'll need firebug.

Similar Threads

  1. How to close a window containing an a5w page or not open it in the first place???
    By -Jinx- in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 10-22-2012, 10:24 PM
  2. Close a5w page in tabbed_ui
    By Peter.Greulich in forum Application Server Version 11 - Web/Browser Applications
    Replies: 13
    Last Post: 07-30-2012, 08:47 AM
  3. How to have linked A5w Page where the linked A5w Page should replace the current page
    By bobalston in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 02-12-2012, 08:42 PM
  4. Error /Corruption on inserting page layout component into a5w page
    By Claire Shuttleworth in forum Application Server Version 10 - Web/Browser Applications
    Replies: 5
    Last Post: 10-20-2010, 10:00 AM
  5. Open a a5w page from an a5w page
    By chandran in forum Web Application Server v7
    Replies: 2
    Last Post: 02-02-2006, 04:02 PM

Bookmarks

Posting Permissions

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