Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook



The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic

Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.

If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.

Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.

Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Passing Javascript Variables between 2 A5W Page Dialogs

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Re: Passing Javascript Variables between 2 A5W Page Dialogs


    This is a case of needing to traverse across the DOM to get the desired results. A5 runs .a5w pages in an Iframe. When you launch dialog two from the page that dialog one is on it opens in an ajax window (in an Iframe) on the current page. the Iframe, in essence, is another "document" hence it has another level of window vars that are a child of the parent window. You can get at the vars in the child from the parent and the parent from the child but you need to know the hierarchy.

    Just another point I'd like to clarify that seems to have a lot of people confused. window.myvar = 'test' is the same as window['myvar'] = 'test' is the same as myvar = 'test'. They are all creating a variable at the top level (window) of the DOM. You don't need the window prefix anymore than you do when you use an alert(), which really means window.alert(). alert() is just one of the many methods of the window object. Prefixing "window" is a good practice since it lets you, and other developers reading your code, know that you intended to create a global var and didn't just forget to use the "var =" construct.

    In your case where you want the dialog in the called page to set a variable that is part of the calling page you would get at the variable by prefixing window.parent to the variable, as in window.parent.variable_you_want_access. This is telling the browser to look for a variable in the "window" object that called this object. To go the other way, from the calling page to the called page you would use window.frames[1]. child_variable_you_want_access, where the index of the iframe is set by the order that it occurs in the html. In your case you're only opening one new Iframe so it will have the index of 1, since the parent page will be in the index slot of 0, because the parent is also running in an Iframe, as are all .a5w pages.

    Once you get a grasp on the DOM and how A5 uses Iframes for just about everything it gets a lot easier to understand how to interact with them.

    I've attached a zip with two pages and two dialogs to demonstrate the concept. Publish the pages to local host and run the parent page. Clicking the "Show Var" button will display the current value of the global variable in an alert(). Click the "open child page" button an the second dialog will open as an a5w page in a window. From the window you can see the value of the parent windows global var by clicking the "show window.parent.myparentvar" button. It will have the same value as the parent. Now if you click the "change parent var" button it will change the value of the global var that is in the parent window.

    I hope this helps to clarify the whole DOM widow var thing.

    In Frank's example, he's using two pages and opening them in the same window of the browser. If you use his example and open the second page in a new tab (a new window) you'll see that the var's value does not persist. (name is a built in property of the window object which is why you don't get "undefined" in the alert)
    Jim Coltz
    Alpha Custom Database Solutions, LLC
    [email protected]


    • #17
      Re: Passing Javascript Variables between 2 A5W Page Dialogs


      That is a very good & interesting explanation. I only wonder about "A5 runs .a5w pages in an iframe" ? Don't you mean A5 runs dialog components in an iframe ?

      Tell me and I'll forget; show me and I may remember; involve me and I'll understand


      • #18
        Re: Passing Javascript Variables between 2 A5W Page Dialogs

        Originally posted by Clipper87 View Post

        That is a very good & interesting explanation. I only wonder about "A5 runs .a5w pages in an iframe" ? Don't you mean A5 runs dialog components in an iframe ?
        Yes, more succinctly, Alpha runs its components; dialogs, grids, custom components, etc. in Iframes.
        Jim Coltz
        Alpha Custom Database Solutions, LLC
        [email protected]


        • #19
          Re: Passing Javascript Variables between 2 A5W Page Dialogs

          Thanks Jim, I really appreciated explanations like that. I half-guessed that each page was being opened in it's own "space" so to speak. Certainly pop-ups. I just didn't know the syntax for getting at the other spaces... so that's excellent.

          For Franks example... as you point out, it's all in the same space. If you add a button to Dialog 1, and open Dialog 2 with Action Javascript... a pop-up... Dialog 2 alert will now respond with a of A5dlg0.BODY... because that's where it's now living.

          Thanks Frank, and Frank... these discussions really help.

          Thank Jim... this is great information.


          • #20
            Re: Passing Javascript Variables between 2 A5W Page Dialogs

            Just ran your example, Jim, and it's exactly what I'm looking for. I'd much rather use this than Dom Storage (or it is the same thing???) more or less? I think both yours and Franks examples are great depending of exactly what you need to do. This type of information really help me understand further the basics of what we're doing with all this... and how to get at it.

            What's your opinion of DOM Storage?


            • #21
              Re: Passing Javascript Variables between 2 A5W Page Dialogs

              Thank you Jim for that explanation. I have done many things with Alpha that just work. It is much easier when you understand why.
              Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO.


              • #22
                Re: Passing Javascript Variables between 2 A5W Page Dialogs

                Jim I really find this interesting however your zip kills v12 when you go to open the components. can you check this please - I know its a long time ago but i really just want to get a value out of the iframe in a UX back to a a field n the same UX.

                As always love your work.
                Insanity: doing the same thing over and over again and expecting different results.
                Albert Einstein, (attributed)
                US (German-born) physicist (1879 - 1955)


                • #23
                  Re: Passing Javascript Variables between 2 A5W Page Dialogs

                  Peter, I just downloaded and ran the components and pages in V12, latest pre-release, and didn't have any issues.

                  Since I posted that explanation I've changed techniques a bit to better get control of the various ways A5 opens and embeds components so that communication between them is easy.
                  Jim Coltz
                  Alpha Custom Database Solutions, LLC
                  [email protected]