How to Force Clear Form Data on Back?
I don't know what I am doing wrong, or maybe it just can't be done, but I have tried everything. I tried using meta tags to clear cache, and several scripts that just didn't work out.
I have an email list subscribe form on the main page of a website.
On submit, it goes to a "thankyou confirmation" page, that pages has a "Go Back" button, that works.
It could also be a absolute url to go to instead of back, whichever will work!
When it goes back, the email address is still in the form field!
How do I get rid of that? It seems easy enough, but I can't figure it out.
Is it some lame feature of my browser to save the form data? If so, can I force it to purge that data?
You will be my best friend forever if you can end my suffering! TRhanks in Advance! :)
Many thanks, this Java Script works fine, never got other body onloads to work
:)
Quote:
Originally Posted by
Ultimater
Here's how to clear multiple elements by their Ids similiar to the way you are trying to do it:
Code:
onload="clearElementsById( 'email','name','more' );"
However, you need to define
clearElementsById() first:
Code:
function clearElementsById(){
for(var i=0,a=arguments.length,el;i<a;i++){
el=(document.getElementById)?
document.getElementById(arguments[i]):(document.all)?
document.all[arguments[i]]:(document.layers)?
document[arguments[i]]:null
if("value" in el)el.value=""
else if("innerHTML" in el)el.innerHTML=""
}
}
Untested (note I write flawless javascript code 95% of the time)