• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Clear just the back history... [Urgent]

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form with lot of buttons and want to clear this form. When i click on the clear button, i want to clear this form in such a way that it does not reset to default values. It has to set all the html fields values to "" because this form will be used to update as well as create new form. I am doing the clear part as shown in the following clearForm function.
Url for creating and updating this form http://localhost:8080/temp.jsp -- for creating a new form http://localhost:8080/temp.jsp?id=1234 -- for updating this form
function clearForm()
{
document.myform.reset();
window.location.href="http://localhost:8080/temp.jsp";
}
This clears out all the fields, but the problem is when i press the back button i can still see the data in all the text fields and the url to be "http://localhost:8080/temp.jsp?id=1234"
how do i set the previous history to just "http://localhost:8080/temp.jsp" and not the parameter part.
Is there a way to clear the Back button history?
Appreciate your help!
Thanks,
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Mendy,
What you can do for this is write your clearForm() function in a different way as...
function clearForm()
{
location.replace("http://localhost:8080/temp.jsp");
}
What this "location.replace(URL)" does is,it replaces the current existing page in the history with the new URL page.
Hope that helped.
Bunty
 
reply
    Bookmark Topic Watch Topic
  • New Topic