469,592 Members | 1,766 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

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.
Oct 5 '07 #1
2 1020
shweta123
692 Expert 512MB
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...

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.
Oct 5 '07 #2
jhardman
3,406 Expert 2GB
Smithy,
Expand|Select|Wrap|Line Numbers
  1. <form ...>
  2. <input type="text" name="text1" value="<%=request("text1")%>">
  3. <select name="select1">
  4. <%
  5. dim options(3)
  6. options(0) = "daffodils"
  7. options(1) = "tulips"
  8. options(2) = "jonquils"
  9. options(3) = "nasturtiums"
  10. for i = 0 to 3
  11.    response.write "<option "
  12.    if request("select1") = options(i) then
  13.       response.write "selected "
  14.    end if
  15.    response.write "value='" & options(i) & "'>" & options(i) & "</option>" & vbNewLine
  16. next %>
  17. </select>
  18. </form>
Jared
Oct 8 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.