...

View Full Version : sending a thank you page for email message



chelvis
12-29-2003, 08:24 PM
In my website I am only using HTML and Javascript - meaning it is a very simple flat website without any server communication.

In one of the pages, I have a form. When the user submits the form the information goes to my email address. Now I want to do some thing like when the user submits the form I should get the submitted information. But at the same time a thank you page should appear. How can I do both of these actions at the same time in one image?

Here is the code without javascript for thank you page:
<table>
<FORM name=frmfeedback action="mailto:myname@msn.com?subject=Request for more information" enctype="text/plain" method="POST" onsubmit="return Validator(frmfeedback);">
<tr><td valign="top" height="15" colspan="3"><img src="images/sp.gif" border="0"></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">First Name: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="firstname" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Last Name: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="lastname" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Company/Institution: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="company" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Address1: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="address1" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Address2: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="address2" size="24" maxlength="75"></a></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">City: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="city" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">State/Province/Region: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="state" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">ZIP/Postal Code: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="zip" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td colspan="2">&nbsp; </td><td valign="top" align="middle"><input type="image" name="submit" src="images/submit.gif" border="0"></td></tr>
</form>
</table>


Please any one suggest me

Willy Duitt
12-29-2003, 10:42 PM
Your form handling really should be done using serverside rather than mailto:

But, something like this should work:

<FORM name=frmfeedback action="mailto:myname@msn.com
subject=Request for more information" enctype="text/plain"
method="POST" onsubmit="return Validator(frmfeedback);
setTimeout('location.replace(\'http://google.com\')',5000)">

I am using the setTimeout in this example to delay the
redirection for several seconds (5000 = 5 seconds)

A better solution would be to add the form submit() and
location.replace() to your validation function and use a
button to call the function rather than using a submit.

eg:


<script type="text/javascript">
function Validator(frmfeedback){
if(this or that){
yada validation
}
else{
yada validation
return true;
document.frmfeedback.submit();
location.replace('http://google.com');
}
}
</script>
</HEAD>

<BODY>
<FORM name=frmfeedback action="mailto:myname@msn.com
subject=Request for more information" enctype="text/plain" method="POST">
<input type="button" value="submit" onclick="Validator(frmfeedback)">

.....Willy

chelvis
12-30-2003, 04:10 PM
Thank you very much for the answer!.

It is working in IE and NN 4.X. But this isnot working in NN 6.2
In NN 6.2 it doesnt even send the email. Why? Here is my code:

<html>
<head>
<SCRIPT language=JAVASCRIPT>
var submitted=0;
function Validator(frmfeedback)
{
if (submitted==0) {
if (frmfeedback.firstname.value.length == 0) {
alert("Please enter your first name");
frmfeedback.firstname.focus();
return false ;
}
if (frmfeedback.lastname.value.length == 0) {
alert("Please enter your last name");
frmfeedback.lastname.focus();
return false;
}
if (frmfeedback.company.value.length == 0){
alert("Please enter your organization");
frmfeedback.company.focus();
return false;
}

if (frmfeedback.address1.value.length == 0){
alert("Please enter your address");
frmfeedback.address1.focus();
return false;
}
if (frmfeedback.city.value.length == 0){
alert("Please enter the city");
frmfeedback.city.focus();
return false;
}
if (frmfeedback.state.value.length == 0){
alert("Please enter the State/Province/Region");
frmfeedback.state.focus();
return false;
}
if (frmfeedback.zip.value.length == 0){
alert("Please enter the ZIP/Postal code");
frmfeedback.zip.focus();
return false;
}

if (frmfeedback.phone.value.length == 0) {
alert("Please enter your phone number.");
frmfeedback.phone.focus();
return false;
}
if (frmfeedback.email.value.length == 0) {
alert("The E-Mail field is empty.\nPlease enter your E-Mail address.");
frmfeedback.email.focus();
return false;
}

if (frmfeedback.email.value.indexOf ('@',0) == -1 ){
alert("The E-Mail field contains an invalid Email Format.\nPlease enter your correct E-Mail address.");
frmfeedback.email.focus();
return false;
}
submitted=1;
document.frmfeedback.submit();
location.replace('http://www.google.com');
}

else {
alert('The form has already successfully been submitted.');
return false;
}
location.replace('http://www.google.com');
}
</script>

</head>

<body>
<table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#F5F5F5">
<FORM name=frmfeedback action="mailto:myname@msn.com?subject=Request for more information" enctype="text/plain" method="POST" onsubmit="return Validator(frmfeedback);">
<tr><td valign="middle" align="right"><A CLASS="MBlack">First Name: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="firstname" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Last Name: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="lastname" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Company/Institution: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="company" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Address1: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="address1" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Address2: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="address2" size="24" maxlength="75"></a></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">City: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="city" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">State/Province/Region: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="state" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">ZIP/Postal Code: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="zip" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">Phone Number: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="phone" size="24" maxlength="25"></a><font color="red"><b>*</b></font></td></tr>
<tr><td valign="middle" align="right"><A CLASS="MBlack">E-mail Address: </a></td><td valign="top" width="15"><img src="images/sp.gif" border="0" width="15" height="1"></td><td valign="top"><A CLASS="MBlack"><input type="text" name="email" size="24" maxlength="75"></a><font color="red"><b>*</b></font></td></tr>
<tr><td colspan="2">&nbsp; </td><td valign="top" align="middle"><input type="button" value="submit" onclick="Validator(frmfeedback)"></td></tr>
<tr><td colspan="3" height="8"><img src="images/sp.gif" height="8"></td></tr>
</form>
</table>
</body>
</html>

Willy Duitt
12-30-2003, 06:15 PM
I don't know why it's not working with NN6.2
And I do not have that browser here to check it.

Did it work properly before adding the location.replace()?

You could try removing the onsubmit from your form tags.
onsubmit="return Validator(frmfeedback)"
This is not needed since you are using the button.

.....Willy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum