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,