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

Announcement

Collapse

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Passing Javascript Variables between 2 A5W Page Dialogs

    I have 2 Dialogs. Both Dialogs run within their own A5W page.

    Dialog 1 has a button that opens Dialog 2 through Action Javascript (Open an A5W Page), specifying the A5W page to open and passing into Dialog 2 some variables.

    Dialog 2 is setting some Javascript Variables. (I've tried local (using var) and Global (not using var).

    Dialog 2 has a Close button, set up using the Window Buttons in the Action Javascript Call from Dialog 1.

    I need to use those variables created in Dialog 2, to be available in Dialog 1.

    I thought it would be fairly easy to pass around Variables from Dialog to Dialog. And I think it is, if they're not running within A5W pages.

    I've tried Window[] variables but they don't last beyond the A5W page.

    The other solution I tried is, at the point in Dialog 2 where I set my Variables, I called an Ajax Callback to set a session variable.

    This almost works but is not consistent. Sometimes the session variable is there in Dialog 1... sometimes not. I think that's a Javascript timing thing... not sure.


    Has anyone done this? Am I missing something? Really appreciated any help or suggestions.

    Thanks,

    David

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

    Been working away at this for a while. The Session Variables are not being refreshed once I get back to Dialog 1... at least not fast enough. In the Dialog Close button (which is defined on Dialog 1, but executed on Dialog 2) I even put all the javascript into a function and wrapped the function in a setTimeout for 10 seconds... still no luck.

    So... I found I was asking the wrong question... the question which was inside Alpha 5. How about an outside answer. And there is one. DOM Storage.

    https://developer.mozilla.org/en-US/docs/DOM/Storage

    I have no idea what ramifications this may have... but holy smokes it works. There are a few different ways to use it... I just tried sessionStorage.setItem and getItem. It's perfect. It's too good to be true... so now I'm waiting for the other shoe to drop...

    Comment


      #3
      Re: Passing Javascript Variables between 2 A5W Page Dialogs

      David,

      Have you tried using the state object? It seems that this may be the case where the state object is the solution. I will look into the info at the link you provided.

      Form the link
      The sessionStorage object is most useful for hanging on to temporary data that should be saved and restored if the browser is accidentally refreshed.
      This may be a problem or a big help.
      Last edited by frankbicknell; 04-08-2013, 08:56 AM.
      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. http://www.devart.com/dbforge/mysql/studio/

      Comment


        #4
        Re: Passing Javascript Variables between 2 A5W Page Dialogs

        I know... I read that as well - about hanging onto data. With all things, I guess it depends on what you're using it for. In my case it's a string name, not sensitive information. There's also local storage - which may be better... not sure... have to read more about that.

        I really look forward to your opinion about this.

        I thought the same thing about the state object. I don't think the state object persists outside of its window. I set a state object in Dialog 2 and tried to access it in Dialog 1 and it wasn't there.

        Both Dialogs are run in an A5W page. But even more than that, the Dialog 2 A5W Page is being called by an Action... so I believe it's being wrapped up even further.

        Maybe I wasn't using the state object properly... not sure.

        Comment


          #5
          Re: Passing Javascript Variables between 2 A5W Page Dialogs

          David I have not had a chance to experiment with the scope of the state object beyond what the videos show. I guess with using DOM Storage as long as you know that the variables are 'hanging on' then you can account for that in the program.
          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. http://www.devart.com/dbforge/mysql/studio/

          Comment


            #6
            Re: Passing Javascript Variables between 2 A5W Page Dialogs

            Agreed. In my case the variable does not get used unless to go through a process and push a button to use it. Just in case though, I'll set the variable to nothing coming into the dialog.

            Comment


              #7
              Re: Passing Javascript Variables between 2 A5W Page Dialogs

              David,

              window.name does survive a5w pages
              Frank

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

              Comment


                #8
                Re: Passing Javascript Variables between 2 A5W Page Dialogs

                Originally posted by Clipper87 View Post
                David,

                window.name does survive a5w pages
                Hey Frank,

                I'm not sure what you mean by window.name

                Could you elaborate how I'd use that between two A5W/Dialogs?

                Thanks.

                Comment


                  #9
                  Re: Passing Javascript Variables between 2 A5W Page Dialogs

                  David,

                  window.name is a variable that does survive a5w pages, so in page1.a5w you can store some value in it, then browse to page2.a5w and it will still be available. Check it out!
                  Frank

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

                  Comment


                    #10
                    Re: Passing Javascript Variables between 2 A5W Page Dialogs

                    Correct me if I am wrong. I think the syntax is like this.
                    Code:
                    Window.myDotVariable['myWindowVariable']
                    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. http://www.devart.com/dbforge/mysql/studio/

                    Comment


                      #11
                      Re: Passing Javascript Variables between 2 A5W Page Dialogs

                      Cool... going to have a look.

                      Comment


                        #12
                        Re: Passing Javascript Variables between 2 A5W Page Dialogs

                        Frank,

                        Simply use window.name = "abc";
                        Frank

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

                        Comment


                          #13
                          Re: Passing Javascript Variables between 2 A5W Page Dialogs

                          Does anyone know if there is a good practice or an industry standard for using variables? Should I use session.variables or should I use window variables. Is there a security risk with DOM variables? I don't know the nuances and I'm to the point where I'm starting to code in this area. Thoughts?

                          Comment


                            #14
                            Re: Passing Javascript Variables between 2 A5W Page Dialogs

                            Originally posted by Clipper87 View Post
                            Simply use window.name = "abc";
                            I'm afraid this didn't work for me. Maybe I don't know how to use it properly.

                            In Dialog_2 : window.name = vGlobalFolderName; where vGlobalFolderName is "My New Folder"

                            In Dialog_1 : alert(window.name); results in A5dlg0.BODY

                            Am I using it correctly, Frank, or is there more to it.

                            Comment


                              #15
                              Re: Passing Javascript Variables between 2 A5W Page Dialogs

                              David,

                              use the attached sample project & publish it to your local webroot. browse to page1.a5w, enter a value in the textbox & click on the button "set window.name" then click on the link "browse to page 2"
                              on page 2 click on the button "alert window.name" ; your entered value will be displayed. Repeat with window.testvar and notice the difference.

                              wn.zip
                              Frank

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

                              Comment

                              Working...
                              X