Keep My Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smithysrat
    New Member
    • Oct 2007
    • 1

    Keep My Form

    Hi,

    I have a form which is filled in with various parameters by the user are used to build an SQL select statement to bring back the right data when the user clicks submit.

    This all works well but when the data is returned (to the same page) all of the parameter fields are cleared. I want whatever has been typed, check boxes etc. into the form to stay as they were at the submission time.

    I'm pretty new to ASP so help!

    Thanks.
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    The parameter fields on your page are getting cleared because when you submit the page ,page gets reloaded and all the parameter fields are also reset.
    To handle this,

    1) You can store parameters in table before submit and fill the fields by reading these values from table after page is submitted again.

    2) You can send the parameter values by querystring, if the parameters you are using are less.

    Hope so this is what you want...

    Originally posted by smithysrat
    Hi,

    I have a form which is filled in with various parameters by the user are used to build an SQL select statement to bring back the right data when the user clicks submit.

    This all works well but when the data is returned (to the same page) all of the parameter fields are cleared. I want whatever has been typed, check boxes etc. into the form to stay as they were at the submission time.

    I'm pretty new to ASP so help!

    Thanks.

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      Smithy,
      [code=asp]<form ...>
      <input type="text" name="text1" value="<%=reque st("text1")%>" >
      <select name="select1">
      <%
      dim options(3)
      options(0) = "daffodils"
      options(1) = "tulips"
      options(2) = "jonquils"
      options(3) = "nasturtium s"
      for i = 0 to 3
      response.write "<option "
      if request("select 1") = options(i) then
      response.write "selected "
      end if
      response.write "value='" & options(i) & "'>" & options(i) & "</option>" & vbNewLine
      next %>
      </select>
      </form>[/code]Jared

      Comment

      Working...