How to retain values in text box after submit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sonasang
    New Member
    • Sep 2007
    • 27

    How to retain values in text box after submit

    Hi,
    I am creating a web page using ASP and Javascript.
    When submit button is clicked , It will search for the values in the input given(in the input box).
    How to retain the values in the input box after the submit button is clicked



    Thanks in advance
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Does the page submit back to the same page?

    Just use ASP to populate the text box with the input from the previous page.

    Comment

    • Sonasang
      New Member
      • Sep 2007
      • 27

      #3
      Hi ,

      Yes the page is submitted back to the same page and the values which are retrieved from the databases are displayed in the same page.


      Here i am using a input box and list box. In input text box i will enter values and retrieve values from the DB. Using List box,if we select a value from the list box and using a submit button which will select values for that query and display the result in the same page.

      Also the query selection part has been done in the ASP part.

      Thanks in advance

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Originally posted by Sonasang
        Hi,
        I am creating a web page using ASP and Javascript.
        When submit button is clicked , It will search for the values in the input given(in the input box).
        How to retain the values in the input box after the submit button is clicked



        Thanks in advance
        Where you want to restore the text value after page submission?

        Debasis

        Comment

        • Sonasang
          New Member
          • Sep 2007
          • 27

          #5
          The values which I retrieve from the database using ASP will be displayed in the same page in the table format and the Text boxex are displayed in the top and the retrieved values in the Table format in the down.

          Comment

          • dmjpro
            Top Contributor
            • Jan 2007
            • 2476

            #6
            Originally posted by Sonasang
            The values which I retrieve from the database using ASP will be displayed in the same page in the table format and the Text boxex are displayed in the top and the retrieved values in the Table format in the down.
            So you want to retrieve the text value in Server Side.
            So use Server side script ..... what acode said to do

            Debasis ...

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Originally posted by Sonasang
              The values which I retrieve from the database using ASP will be displayed in the same page in the table format and the Text boxex are displayed in the top and the retrieved values in the Table format in the down.
              Try something like
              [code=asp]<input name="text1" type="text" value="<%=Reque st.QueryString( "text1")%>" >[/code]

              Comment

              • Sonasang
                New Member
                • Sep 2007
                • 27

                #8
                Hi Acoder,
                I tried with the options u specified but its not working :(.....

                Thanks for ur suggestion.

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  Are you using GET or POST to submit the data?

                  Comment

                  • Sonasang
                    New Member
                    • Sep 2007
                    • 27

                    #10
                    Originally posted by acoder
                    Are you using GET or POST to submit the data?
                    I am using post in my coding

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #11
                      Originally posted by Sonasang
                      I am using post in my coding
                      Then you'd be looking for Request.Form I think.

                      Whatever you've used in your query to retrieve the value of the text box, you'd use that to populate the text box again. Of course, since you're on the same page, it be undefined (before the submit), so you should check for that to prevent errors.

                      Comment

                      Working...