How to clear signup form on reload?

I am using this code on my website to allow visitors to sign up for the newsletter:

<style type="text/css">
form {padding-left: 100px;}
span.label,span.spacer,span.multiple span {width:120px;float:left;}
span.multiple {float:left;}
span.button {padding-left:120px;}
div.clear {clear:both;padding-top:5px;}
.button input {width: 188px; height: 50px;}

<!-- Form -->

<form action="" method="post" id="subForm">

<span class="label"><label for="yhms-yhms">Email Address:</label></span>
<span><input type="text" name="cm-yhms-yhms" id="yhms-yhms" size="25" /></span>
<br />
  <span class="label"><label for="Country">Country:</label></span>
  <span><input type="text" name="cm-f-truua" id="Country" size="25" /></span>
<div><br />
<span class="button"><input type="submit" value="Subscribe" /></span>

It's a copy/paste from Campaign Monitor's Create a subscribe form feature (with minor CSS tweaks).

What I was wondering was how to clear the form on reload? That is when the user has gotten the confirmation that they signed up and then press the back button or 'Click here to return to the site' (like the confirmation states).

I know there must be something easy I can add to the form somehow, but I'm not good at PHP. Any help would be greatly appreciated.

rosastef, 7 years ago

I think I figured it out myself and decided to post the solution here in case somebody else got into the same dilemma.

I added this code to the header of my document:

function clearForms()
  var i;
  for (i = 0; (i < document.forms.length); i++) {

Now my form clears on reload in Internet Explorer. I was only concerned with IE because my form will only be used on an in-store display that uses and old version of IE.

Please note: The code does not seem to work as intended in Firefox (have not checked other browsers).

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free