Click to See Complete Forum and Search --> : empty the form when click back button


fyanym
04-06-2005, 02:49 AM
i have a page with a order form, after i fill in the form and click submit button, it will go to another page. But when i click back button at the IE toolbar, it will return to the order form page. what i want is when i click the back button, the textbox at the order form is empty. what can i do?

buntine
04-06-2005, 03:17 AM
So, when you click the back button, you want to be certain that the order form is empty? Or, do you want to make sure the inputted data is retained in the form?

I'm just a bit confused on the desired outcome at the moment.

Regards.

fyanym
04-06-2005, 03:23 AM
when i click the back button, i don't want the input data not retained in the form, i want the form empty or display some text like the page has expired and plz click refresh

buntine
04-06-2005, 03:33 AM
You could empty the form via JavaScript. In the onload event. <body onload="clearForm();">

If you decide to take that method, ask in the JavaScript for a quality solution.

I am not certain whether or not the HTTP_REFERER variable is set when you use the "back" button, but if it is, you can check it (Request.ServerVariables("HTTP_REFERER")) and make sure it does not equal the second page. If it does, display a message. But, I think IE might simply consult the cache when a user clicks the "back" button.

You may be able to set a META tag that tells the browser that it cannot cache the page, and therefore, when a user clicks "back", the page will be loaded fresh and the entered data will not be retained.

Regards.

buntine
04-06-2005, 03:34 AM
Here is the no-cache META tag. Place it within your <head> and </head> elements.

<meta http-equiv="pragma" content="no-cache">

fyanym
04-06-2005, 04:29 AM
the meta tags seems not working propery...
what i meant is like the yahoo 1st page, i can type the keywork at the textbox, then i click search button to search the relevant information, when i go to the information page, i click the back button on the tools bar, it back to the yahoo 1st page and still contain my input keyword at the textbox...my case is dont want the keyword still contain there. but display a msg " the pages have been expired"..or empty the keyword input textbox..