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

Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

    I'm certain that I am doing something fundamentally wrong, but I have been struggling to find it and wanted to ask for help. Of course, I was trying to things more complex but I kept scaling back to find my problem and this is where I am at.

    I have two grids, Grid1 and Grid2. I added a button to Grid1 and added two pieces of Action Javascript to the button's onClick event. The first is an AJAX callback that calls the Xbasic function SetMyVariable.

    FUNCTION SetMyVariable AS C ()
    	session.taco = 512
    	SetMyVariable = "alert('session.taco = " + session.taco + "');"
    This works fine, the prompt shows the correct value for the session variable.

    The second part of the onClick event opens Grid2 in an AJAX popup window.

    Grid2 contains a button that has an onClick event that calls an AJAX callback to call the Xbasic function ShowMyVariable.

    FUNCTION ShowMyVariableAS C ()
    	ShowMyVariable= "alert('A5.msgBox.hide();session.taco = " + session.taco + "');"
    This one does not work. Generally, I get the error that says session.taco is not defined. Or if the alert works, it says that session.taco is some other value (I have been changing the constant in SetMyVariable to test things).

    I'm guessing this is something seemingly trivial to you guys, but I'm stumped. Any help would be great!


  • #2
    Re: Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

    It works for me.
    Why does your ajax callback not have the (e as p) in both of the functions? If you created your functions by copying the code that Alpha creates, it should have the (e as p).
    Try adding that as in:
    function SetMyVariable as c (e as p)
    session.taco = 512
    SetMyVariable = "alert('session.taco = " + session.taco + "');"
    end function
    Jay Talbott
    Lexington, KY


    • #3
      Re: Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

      I have the (e as p) in both of them, I just forgot to copy and paste that part in my first post. Would it matter if my Xbasic functions are in an AEX file? When I click the button in Grid2 I get the error "...Property not found session.taco subelement not found."

      I'll play with it some more. Maybe write new functions and create new grids, clear the AEX cache (I have restarted the server several times). Perhaps I'll even write the Xbasic into the grids. Where does that go again?


      • #4
        Re: Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

        That goes in the properties part of the grid under Xbasic functions.
        Sounds like you need to "Gwennify" this. That means you need to take it down to its basic level, and add one variable at a time, and check if each change works.
        Take it a step at time, and don't change two elements at once.
        Hope this helps.
        Jay Talbott
        Lexington, KY


        • #5
          Re: Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

          Well I may have figured out the root cause of my problem, but I'm stuck with how to fix it.

          I went back and re-made the two grids.

          Grid1 has two buttons on it.
          Button1 has an onClick that does an AJAX callback to call the Xbasic function:
          FUNCTION SetMyVar as C (e as p)
          	session.taco = 1024
          	SetMyVar = "alert('session.taco = " + session.taco + "');"
          END FUNCTION
          Button2 opens Grid2 in an AJAX popup window.

          Grid2 has a button on it that does an AJAX callback to call the Xbasic function:
          FUNCTION ShowMyVar as C (e as p)
          	ShowMyVar = "alert('session.taco = " + session.taco + "');"
          END FUNCTION
          This setup works just fine. If I go to the Xbasic declaration of SetMyVar() and change the value set to session.taco and then click Button1 and then Button2 in Grid1 and then click the button in Grid2 I get the correct messages.

          Here is where I get problems: If I modify the onClick of Button1 (the one on Grid1) to open Grid2 in an AJAX popup as well as do the AJAX callback to set session.taco, then the button on Grid2 that shows the value of session.taco gives me an error that session.taco is not defined of the value it gives me is the previous value I had set to it.

          I think that the problem is that the call to open Grid2 in the AJAX popup executes before the AJAX callback to set session.taco completes, thus Grid2 would have the wrong (or an undefined) value in session.taco. On the other hand, that doesn't seem to make sense. The AJAX callback should always get the value of session.taco from the server, shouldn't it? The alert from Grid1 always has the correct value of session.taco.

          Does that seem like a correct reading of what the problem is? Further, any idea on how to fix it? Is there a way to wait for the AJAX callback to complete before opening the popup window? Or even better, what I really want is a way to send data from Grid1 to Grid2. That is why I was doing the callbacks. My thought was, take what is in the grid, send it to the server and store it in session variables. Then when I need that data while working on Grid2, get it from the session variables. I realize I can open Grid2 in an a5w page and pass the data in Grid1 in the URL, but I would rather not. Any suggestions?

          Thanks for the help Jay!


          • #6
            Re: Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

            Trying to run multiple AJAX calls at (nearly) the same time can be fraught with problems.

            First thing to do is to see about setting your values at different times so there's no "competition" with the calls.

            You should be using Firefox with Firebug, which will help you see when callbacks are made.


            • #7
              Re: Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

              I have Firebug, but I had only been using Live Preview. Firebug shows the events firing in the correct order, but they are working asynchronously so when they complete relative to each other is a different story (correct?). Interestingly, a Live Preview in Firefox works correctly everytime (so far), while Live Previews in IE, Chrome, and Safari suffer the previously described problems.

              I am starting to think that this is just the way things work and I'll have to find some other way to do what I want. I guess just using an a5w page and passing the data along the URL would be acceptable, but not as clean. Anyone remember how to access the GET data that is in the URL from Xbasic?


              • #8
                Re: Trouble with Session Variables, AJAX Callbacks, and AJAX Popup Windows

                I think you could create a second, hidden button set up to open grid2. Then in the AJAX callback, set the variable and return the Javascript needed to call the function in the hidden button.