Hey,
I've got several text fields and such on my form, and when you hit submit it goes to the next page which says "Thanks for signing up", more or less. However, if you hit the back button it goes back to the webpage and all the previously entered details are there.
How would one go about clearing them? I thought I knew how but it's not been working. So far I've written a javascript function:
And this code runs... (I've confirmed this with an alert()) however when I hit back it has all those details there. The function clearForms() is called on onLoad, and I've also tried on unLoad, as well as onSubmit and onReset on the actual form (rather than the entire page). However, it's not worked so far.
Any thoughts on what I might be doing wrong? Thanks.
I've got several text fields and such on my form, and when you hit submit it goes to the next page which says "Thanks for signing up", more or less. However, if you hit the back button it goes back to the webpage and all the previously entered details are there.
How would one go about clearing them? I thought I knew how but it's not been working. So far I've written a javascript function:
PHP:
<script type="text/javascript">
function clearForms() {
var controlNames = ["Test1", "Test2", "Test3", "Test4", "Test5"];
for (var i = 0; i < controlNames.length; i++) {
var ele = document.getElementById(controlNames[i]);
ele.value = "";
}
}
</script>
Any thoughts on what I might be doing wrong? Thanks.