faqts : Computers : Programming : Languages : JavaScript : Forms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

16 of 25 people (64%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How do I generate a thank you page after a form submission with mailto:?

May 16th, 2000 08:38
Martin Honnen,


Note first that mailto: urls are unreliable and not working with all 
browser/mailer combinations. Note further that the following code just 
uses setTimeout to document.write a thank you note. This will happen 
whether the form was actually submitted or not.

<HTML>
<HEAD>
<SCRIPT>
function thankYou () {
  var html = 
'<HTML><BODY><H1>Thank you for form submission.<\/H1><\/BODY><\/HTML>';
  document.open();
  document.write(html);
  document.close();
}
</SCRIPT>
</HEAD>
<BODY ONLOAD="document.formName.submit1.click(); 
              setTimeout('thankYou()', 3000);">
<FORM NAME="formName"
      METHOD="post"
      ACTION="mailto:whomever@wherever.tld"
      ENCTYPE="text/plain"
>
<INPUT TYPE="hidden" NAME="aField" VALUE="Kibology">
<INPUT TYPE="submit" NAME="submit1">
</FORM>
</BODY>
</HTML>