How do I clear form fields?

Results 1 to 3 of 3

Thread: How do I clear form fields?

  1. #1
    David Brower Guest

    Default How do I clear form fields?

    Greetings!<BR><BR>I&#039m creating an ASP that allows a user to add information to a database. The problem is once the user has submitted the data and then pages back to the form the original data is still in the form fields and if he clicks submit again this will obviously cause an error. Is there some way I make sure the data is gone when I click back to a page? I believe one solution would be to ensure that the page is not cached but I&#039m not at all sure how you do this. Can anyone help me?<BR><BR>Thank you,<BR><BR>David Brower

  2. #2
    Join Date
    Dec 1969

    Default RE: How do I clear form fields?

    If you you call file itself taht ontains the form you can do<BR><BR>document.form.field.value = "" (javascript)<BR><BR>after you have queried the database.<BR><BR>You can also set<BR>&#060;%<BR>Response.ExpiresAbsolute = Now() - 1<BR>Response.Expires = 0<BR>Response.CacheControl = "no-cache"<BR>%&#062;<BR><BR>So that the user will have to reload the page so the form fields will be cleared.<BR><BR>Hope that helps.<BR><BR>Arnaud.

  3. #3
    Milind Bahulekar Guest

    Default RE: How do I clear form fields?

    Dear David Brower,<BR>I would like to suggest you one thing, when u pressed submit button, you can move null values to respective fields. eg. suppose u have a txtname (textbox field) u can simply write - <BR>txtname="". But be sure, first pass the values to respective task & then only assign null values. I am sure it will work. <BR>Let me know on <BR> <BR><BR>bye<BR><BR>Happy Programming,<BR><BR>Milind Bahulekar<BR>Pune (India)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts