Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Ramesh Chandra
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");
 
Chinna Eranna
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>
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!