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

a5w page sequence of events

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

    a5w page sequence of events

    Here is the second example I'm using for understanding the sequence of events. I stole it from another post. I've included the page in an attached file because this stuff is marked up with colors, bold, etc.

    This page has A5 code (shown in blue) embedded in the body and my questions relate to the execution of that code.
    Since it is A5 code it can't run on the browser and in fact it doesn't appear to be in the source of the page viewed from the browser.
    Now, either it's hidden in the page sent to the browser and is sent back to the server at post time or somehow the server knows to execute the code at the time it receives the post.
    I suppose it might even be executed at the initial request as well, just before the server sends out the results.
    Does the session entry in the servers internal table contain a link to code that should run when a post is received? Are there separate links to code for the head, body and any other section containing a5 code?
    Scripts are executed in the browsers but this stuff executes on the server and in this case, only on an A5 server.
    I also wonder about using the same name for multiple elements on the page (the buttons have the same name). Won't that actually create an array and will it not confuse the code when it runs? There are some strange results when this page is executed.

    Any help would be greatly appreciated.

    <html>
    <body>
    <%A5
    dim pTbl as P
    pTbl = table.open("customer")
    if eval_valid("nav_button") then
    select
    case nav_button = "First"
    pTbl.fetch_first()
    case nav_button = "Previous"
    pTbl.fetch_goto(val(this_recno))
    pTbl.fetch_prev()
    case nav_button = "Next"
    pTbl.fetch_goto(val(this_recno))
    pTbl.fetch_next()
    case nav_button = "Last"
    pTbl.fetch_last()
    end select
    else
    pTbl.fetch_first()
    end if
    %>

    <table BORDER="1">
    <tr><td>Customer ID</td><td><%A5 ? pTbl.customer_id %></td></tr>
    <tr><td>First name</td><td><%A5 ? pTbl.firstname %></td></tr>
    <tr><td>Last name</td><td><%A5 ? pTbl.lastname %></td></tr>
    </table>
    <form ACTION="testpage3.a5w">
    <input TYPE="submit" NAME="nav_button" VALUE="First">
    <input TYPE="submit" NAME="nav_button" VALUE="Previous">
    <input TYPE="submit" NAME="nav_button" VALUE="Next">
    <input TYPE="submit" NAME="nav_button" VALUE="Last">
    <input TYPE="hidden" NAME="this_recno" VALUE="<%A5 ? pTbl.recno() %>">
    </form>
    <%A5
    pTbl.close()
    %>

    </body>
    </html>

    #2
    Re: a5w page sequence of events

    All the A5W code executes at the server, none of it executes at the browser or client level. The html page that the server sends to the client is prepared by the server; the A5W code directs the server to alter the page it creates, depending on the results of the POST operation it gets from the client.

    When the user presses one of the submit buttons -- say, the "next" button -- two variables are sent back to the server: the value of "nav_button", which is "next", and the value of "this_recno", which might be, say, 7. When that information is sent back to the server, the server executes the a5w code and determines that eval_valid("nav_button") is .T., and then with the
    select...end select statement, moves the customer table pointer to record 7, and then to the next record in sequence; then it sends the customer name, etc., in record 8 to the client, along with the rest of the form and the buttons, generated all over again.

    Comment


      #3
      Re: a5w page sequence of events

      When the user presses one of the submit buttons -- say, the "next" button -- two variables are sent back to the server: the value of "nav_button", which is "next", and the value of "this_recno", which might be, say, 7. When that information is sent back to the server, the server executes the a5w code and determines that eval_valid("nav_button") is .T., and then with the select...end select statement, moves the customer table pointer to record 7, and then to the next record in sequence; then it sends the customer name, etc., in record 8 to the client, along with the rest of the form and the buttons, generated all over again.
      ok. good. thanks again Peter. I'll have to look at your book too I guess.

      But somehow the server needs to know the correct sequence of events. Is it simply because the A5 select...end select code is at the top of the body? Is that why it executes first? It has to because the fields in the table each have xbasic code in them. So we just fall through the body? Or is there a way to order the execution sequence other than just position in the page?

      Comment


        #4
        Re: a5w page sequence of events

        The server generates the entire page before sending it over. The placement of the A5W code in the page is done so that the page is properly formatted HTML, e.g., the head section has to appear before the body. You could just as easily write the whole thing as A5W code,e.g.,

        Code:
        <%a5
        ? "<html>"+crlf()
        ? "<head>"+crlf()
        ? "</head>><body>"+crlf()
        ? "<P>This is an HTML page</P>"+crlf()
        ? "</body></html>"
        %>
        This would send the following page to the user's browser:
        Code:
        <html>
        <head>
        </head>
        <P>This is an HTML page</P>
        </body></html>
        The user would never know that the page was prepared by the Alpha Web server.
        If the order of the Xbasic statements were changed, then improper HTML would be generated. So the order of the Xbasic statements is needed to generate the HTML output.
        Does this make sense to you?

        Comment


          #5
          Re: a5w page sequence of events

          Yes, I think so.

          But I can put code (I am talking about xbasic here) anywhere on a page. In the head, body, or foot section if I want to. If it gets executed, when does it get executed?

          What determines the order of its execution? And, is all code executed everytime the page is generated/re-generated?

          I have the habit of wanting to understand how the action flows. Then, if something doesn't work right I'll at least have a clue about where to look.

          And, once again Peter, thanks for taking the time to discuss this with me.

          Comment


            #6
            Re: a5w page sequence of events

            You can put the Xbasic code wherever you want. It gets executed when the WAS comes to it, and is used to generate more HTML. The HTML in between is also generated when the WAS comes to it. The whole page is sent at once to the client browser -- it's not sent in pieces.

            So these two pages would generate the exact same HTML for a browser:

            Code:
            <%A5
            ? "<html><head></head>"
            %>
            <p>This is an html page </p>
            <%a5
            ? "</body></html>"
            %>
            and
            Code:
            <html><head></head>
            <body>
            <%a5
            ? "<p>This is an html page </p>"
            %>
            </body></html>
            If you want to code something to appear in the HEAD section, then the Xbasic code has to be in the HEAD section; if you want to code something for the BODY section, then the Xbasic has to be in the BODY section.

            Comment


              #7
              Re: a5w page sequence of events

              Thanks Peter. I guess the answer is that any alpha code is executed starting at the beginning of the page and ending at the bottom.

              It just rolls down the page. I'm going to move the select...end select code currently in the body to the head and see if that works.
              .... it does. behaves exactly the same running from the head section. The tr lines containing references to the customer table are still in the body section.

              Now, I'll put it (the select.... end select) after the body, in the foot section.
              ....And that doesn't work. So, it just has to be physically prior to where any references to fields take place.

              I just should have done this right from the start. It would've made it a lot clearer. Just didn't think of it.

              My understanding of what goes back and forth after the first page is sent is still vague and I'm not comfortable with it.. but I'll assume for now that everything is regenerated every time. Perhaps that will rear its head later and if it does, I'll deal with it then. Thanks again.

              Comment


                #8
                Re: a5w page sequence of events

                The discussion about Sessions in the help section was very good to read. In the example it showed session variables getting set up PRIOR to the HTML tag on the page. That implied the top to bottom flow.

                There was also mention of the strange nature of web pages and how each page runs on its own with no connection or knowledge of pages past.

                Session variables give you a continuity and I think it has been that continuity or lack of it between pages that has confused me. So now the picture is becoming clearer. I still am confused about passing data from one page to the next. I'll try session variables and see how that works out.

                Am I correct in thinking that "Session variables" are available through xbasic code only and that I could not access a session variable through a javascript?

                What might really be helpful is a quiz that asks very simple questions about our understanding of how web pages work to make sure our understanding of fundamentals is not lacking.

                Comment


                  #9
                  Re: a5w page sequence of events

                  Well, now it has made a lot more sense. I was able to pass what I wanted from a selection on a list to another page. And, by the way, understand how it got there.
                  I had previously run the session variable example and got it to work. I did however miss the significance of the <%a5.......%> tags.
                  Minor Detail

                  Comment

                  Working...
                  X