Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Form data should not be displayed on clicking back button  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm working on a application where the user will enter his data and submits the application. If he misses out any mandatory field he will be asked to fill it and re-submit. After re-filling the form and submitting the form if he clicks on the back button, all the form-data is still visible. I donot want this to happen. If he clicks back button then he should be displayed with blank form. This is working if he submits the form correctly without missing the mandatory data. Request you to help me out.
FYI.. I've used all the below options.. but it did not work. Quick response is highly appreciated.

httpResponse.setHeader("Pragma","no-cache");
httpResponse.setHeader("Cache-Control","no-store");
httpResponse.setHeader("Expires","0");
httpResponse.setDateHeader("Expires",-1);
httpResponse.setHeader("Cache-Control","no-cache");
httpResponse.setHeader("Cache-Control", "max-stale=0");
httpResponse.setHeader("Cache-Control", "private");
httpResponse.setHeader("Cache-Control","must-revalidate");
httpResponse.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
httpResponse.setHeader("Cache-Control","post-check=0, pre-check=0");
 
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell how your form is written ?
 
Ramesh Chandra
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it was not written in the form.. i wrote that one in the Filter class.
 
Chinna Eranna
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the following code(after replacing your form name) to the end of your form.

<script language="JavaScript">
document.putYourFormName.reset();
</script>
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!