Data being lost when screen sequence is repeated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rmurgia
    New Member
    • May 2008
    • 63

    Data being lost when screen sequence is repeated

    I set up a sequence of asp pages, which pass a variable containing the name of the initial page through the sequence. In this way I can insure that the user cannot open the maintenance pages directly, but must go through the login page first. The sequence goes as follows: MASLogin.asp, MASMaint_01.asp , MASMaint_02.asp , and MASMaint_03.asp . At the end of the sequence, the user clicks the Exit button on page MASMaint_03. This button calls up page MASMaint_01.asp which allows the user to enter another record. The code in question is listed below:

    On page MASLogin.asp:
    strSendForm = “MASLogin.asp”
    <input id="SendForm" name="SendForm" type="text" value="<%=strSe ndForm%>"</td>

    On all other pages:
    strSendForm = Request.Form("S endForm")
    <input id="SendForm" name="SendForm" type="text" value="<%=strSe ndForm%>"</td>

    Everything works fine through the sequence, however, when the user goes to enter a new record on page MASMaint_01, the variable no longer contains the data. It seems that when you call up a sequence of screens and then begin back on the first one, something must be cleared out of memory for it to work properly. Does anyone have any ideas?
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi rmurgia,

    How does the button on MASMaint_03.asp load up the first page? Is it a submit button for a form that points to that page?

    Or are you using a redirect?

    Dr B

    Comment

    • jeffstl
      Recognized Expert Contributor
      • Feb 2008
      • 432

      #3
      Originally posted by rmurgia
      I set up a sequence of asp pages, which pass a variable containing the name of the initial page through the sequence. In this way I can insure that the user cannot open the maintenance pages directly, but must go through the login page first. The sequence goes as follows: MASLogin.asp, MASMaint_01.asp , MASMaint_02.asp , and MASMaint_03.asp . At the end of the sequence, the user clicks the Exit button on page MASMaint_03. This button calls up page MASMaint_01.asp which allows the user to enter another record. The code in question is listed below:

      On page MASLogin.asp:
      strSendForm = “MASLogin.asp”
      <input id="SendForm" name="SendForm" type="text" value="<%=strSe ndForm%>"</td>

      On all other pages:
      strSendForm = Request.Form("S endForm")
      <input id="SendForm" name="SendForm" type="text" value="<%=strSe ndForm%>"</td>

      Everything works fine through the sequence, however, when the user goes to enter a new record on page MASMaint_01, the variable no longer contains the data. It seems that when you call up a sequence of screens and then begin back on the first one, something must be cleared out of memory for it to work properly. Does anyone have any ideas?
      Values are not cleared from memory unless the session is stopped or you tell them to clear in code.

      Need to see how you are directing the user to the first page. Is your variable spelled correctly for that redirect?

      Do you have a form action= to what? The first page?

      The form action determines what page the user is directed to when you submit via a button.

      If you need them to go to the first page then just have your form action="<%=strS endForm%>" but this also means any save code you have will need to be run on that form too.

      If you have your save code on the 03 page then after its done saving you need to have a response.redire ct(strSendForm) after its done

      Also another note, you can keep your passed variable hidden from user modification, which could be another problem if that text box is getting blanked out by a user typo.. if you use:
      Code:
      <input id="SendForm" name="SendForm" type="hidden" value="<%=strSendForm%

      Comment

      • rmurgia
        New Member
        • May 2008
        • 63

        #4
        Originally posted by DrBunchman
        Hi rmurgia,

        How does the button on MASMaint_03.asp load up the first page? Is it a submit button for a form that points to that page?

        Or are you using a redirect?

        Dr B
        Jeffstl, Dr. B,

        Thank you for your responses. I again checked by code and determined what happened. I used embedded VB code but did not extend the end of the code beyond where the variable was referenced. When I extended the code, it worked. Reading both of your responses prompted me to look closer at the code to see how I missed the obvious.

        Thanks again.
        rmurgia

        Before the change
        Code:
         <% 
        Main Procedure
        Sub Main Procedure
        (Variables were created here)
        End Sub
        %>
        HTML with embeded variables <%=strSendForm% >
        (Variables were used here and not being populated)
        -----------------------------------------------------------------
        After the change
        Code:
         <% 
        Main Procedure
        Sub Main Procedure
        (Variables were created here)
        %>
         
        HTML with embeded variables <%=strSendForm%>
        (Variables were used but are now being populated)
         
        <%
        End Sub
        %>

        Comment

        • DrBunchman
          Recognized Expert Contributor
          • Jan 2008
          • 979

          #5
          Glad you got it sorted and thanks for printing the solution.

          Dr B

          Comment

          Working...