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

How to set session variables AND link to totally new page

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set session variables AND link to totally new page

    I have looked and looked and looked. I can do either or but not both.

    How can I set session variables (I know how to do in xbasic) AND, immediately after, cause a new a5w page to get loaded??


    Bob Alston
    Alpha five v11 Tips

  • #2
    Re: How to set session variables AND link to totally new page

    Bob Alston
    Alpha five v11 Tips


    • #3
      Re: How to set session variables AND link to totally new page

      From research, I thought I could do it this way. I inserted a button to my grid. Added an onclick javascript event that was a Adax callback to wbasic defined as a local xbasic code. My custom code is all at the top.

      If I run like this, nothing happens, no redirect to another web page.

      If I remove the comment to allow a session variable to be set, it says it cannot find lastname, firstname or casenum in the "e" newdata.
      Error is: preperty not found e._currentRowDataNew.lastname subelement not found

      yet the name is EXACTLY what is shown in the example code below (and no I did not use "old" because the grid is not editable)

      function SetVariablesAndLinktoNewPage as c (e as p)
      dim session.lastname as c = "Nothing"
      Dim session.firstname as c = "empty"
      dim session.currentclient as c = "no current client"
      'session.lastname = e._currentRowDataNew.lastname
      'session.firstname = e._currentRowDataNew.firstname
      'session.currentclient = e._currentRowDatanew.casenum


      end function
      Last edited by bobalston; 03-11-2012, 12:22 PM.
      Bob Alston
      Alpha five v11 Tips


      • #4
        Re: How to set session variables AND link to totally new page

        Resolved. Video M31 shows how to use Action Scripting to link to a new web page to replace the current one.

        I ultimately used the same Action scripting to call an Ajax callback. But I had to make the grid updatable to get the data passed to the xbasic routine.

        I have a button on the grid that has an on click event and that event has the above two action scripts.

        Bob Alston
        Alpha five v11 Tips


        • #5
          Re: How to set session variables AND link to totally new page

          Grrr. didn't work. apparently due to the async nature of ajax callbacks. Immediately after the callback to set the session variables, the second action, to load the new page was run. Instead, I added javascript to load the new page as the return data string from the callback function that set the session variables. That is flakey. sometimes the session variables are updated by the time the new page is rendered; sometimes not.

          anyone ever have such a problem with timing???

          Bob Alston

          Alpha five v11 Tips


          • #6
            Re: How to set session variables AND link to totally new page

            I'm not entirely sure when you're timing this callback and what you want to achieve.
            If your grid has some validation rules, i would recommend using events that occur after validation to get the new values.. or more so after submitting the records. Are you wanting to update record(s) before you execute this code?
            You could use some of the server/client side events to time your code execution, rather than using a button, but i'm not sure if thats going to work in your sc
            If using an xbasic function i would recommend using this over javascript, if possible:



            • #7
              Re: How to set session variables AND link to totally new page

              Reverse your tactic. Have a button that opens an A5W page with parameters in the URL as Variables. On your A5W page, at the top, include code to save those parameters to session vars. Timing wise, its exactly the same as you trying to set it in the grid before opening the page.
              Steve Wood
              Join the ALPHA DEVELOPERS NETWORK
              There is no Cloud. It's just someone else's computer.
              Web - Mobile - Hosting - Products - Frameworks - Developer Resources
              AlphaToGo | IADN (100% Alpha Anywhere Websites)


              • #8
                Re: How to set session variables AND link to totally new page

                I use a button and an AJAX callback action with the following global xbasic function that is stored in the code tab of the control panel. Set the target variable to the target page you want to load in the "additional data to submit" section of AJAX callback action settings.

                'Global helper function SetAcctSessVar, used to set an account number session variable under session.svAccountNum
                function Ghelp_SetAcctSessVar as c (e as p)
                	dim session.svAccountNum as n
                	IF variable_exists("e._currentRowDataNew.ACCOUNT_NUM") then
                		session.svAccountNum = e._currentRowDataNew.ACCOUNT_NUM
                		session.svAccountNum = -1
                	end if
                	IF variable_exists("") then
                		Ghelp_SetAcctSessVar="setTimeout(function() {window.location = '" + + "'},100);"
                		Ghelp_SetAcctSessVar="setTimeout(function() {var tmp = null;},100);"
                	end if
                end function
                Last edited by LukeS; 03-09-2012, 03:39 AM.


                • #9
                  Re: How to set session variables AND link to totally new page

                  Have you tried the new and improved "Override Settings" option to set a session variable ? I used this for the 1st time this mornig and it works like a champ.
                  I used the "anonymous" function and the whole thing is done with one line of code. The grids I'm working with have been put through the paces and I haven't encountered a single time where setting the session variable with data from the 1st grid and opening the 2nd grid got out of sync. I have tested this on both a local session and on production server WAS (v11 w/current build)

                  from parent grid -> Action Javascript -> Open a Grid Component -> Target Grid Definition - Override Settings - Set Session Variables is at the bottom of the screen and it has a nice help

                  Seemed a little odd to me this is set from something called override settings but it works so well I don't care what they call it


                  • #10
                    Re: How to set session variables AND link to totally new page

                    Thanks to all for the replies. What ultimately worked was this, all done in one ajax callback

                    session.lastname = e._currentRowDatanew.lastname
                    session.firstname = e._currentRowDatanew.firstname

                    Set_Session_Variables = "window.location = 'CLientDetailTabbedPage.a5w';"

                    The reason why my code was flakey is that i never removed the 2nd ajax callback from the original, the one that opened the target page. I had deleted it but neglected to press save. Grrrrrrr. No "DO you wan to save your changes?". Grrrrrrrr

                    Anyway since, I am using the onclick event but the "open an .a5w page, statis HTML page....". Originally I did not understand that this could be used to replace the current page. But it can! Just be sure to set "browser window" and then select "_self" from the options for Browser window name. And yes I switched to page variables from session variables.

                    Bob Alston
                    Alpha five v11 Tips