Click to See Complete Forum and Search --> : Email Form Help
MrFluffy
02-03-2003, 03:43 AM
Pleaze help...
I'm try to email a form to a addy.
The fields are name, address etc with some check boxes.
I've written a bit of javascript to extract the fields which would make up the body of the email but MS Outlook express generates an error. As though the body string is to large.
Any other options...
Cheers in advance for you replies...
said_fox
02-03-2003, 06:33 AM
I think to be more clear situiation, You should paste the java script code you have wrote it, to easly check it
MrFluffy
02-03-2003, 06:45 AM
said_fox, will post code later tonite, on another machine at home.
MrFluffy
02-03-2003, 01:09 PM
Here we go said_fox
function EmailForm()
{
var m = "name@test.com";
var s = "Enquiry";
var b1 = "";
var b2 = "";
var b3 = "";
var b4 = "";
var b5 = "";
var b6 = "";
var b7 = "";
var b8 = "";
var b9 = "";
var b10 = "";
var b11 = "";
var b12 = "";
var b13 = "";
var b14 = "";
var b15 = "";
var b16 = "";
var b17 = "";
var b18 = "";
var b19 = "";
var b20 = "";
var b21 = "";
var cr = "";
cr = "%0D%0A";
b1 = "Personal Information" + cr + "----------------------------------------------------" + cr + cr;
b2 = "First Name : " + form1.firstname.value + cr;
b3 = "Last Name : " + form1.lastname.value + cr;
b4 = "Address : " + form1.streetaddress.value + cr;
b5 = "City/Town : " + form1.city.value + cr;
b6 = "County : " + form1.county.value + cr;
b7 = "Postcode : " + form1.postcode.value + cr;
b8 = "Country : " + form1.country.value + cr;
b9 = "Telephone : " + form1.telno.value + cr;
b10 = "Email : " + form1.email.value + cr + cr;
b11 = "Required Information" + cr + "----------------------------------------------------" + cr + cr;
if(form1.chkscrew.checked == true) b12 = "Screw Compressors" + cr;
if(form1.chkrecip.checked == true) b13 = "Reciprocating Compressors" + cr;
if(form1.chkairtreat.checked == true) b14 = "Air Treatment" + cr;
if(form1.chktools.checked == true) b15 = "Air Tools" + cr;
if(form1.chkspare.checked == true) b16 = "Spares" + cr;
if(form1.chkmobile.checked == true) b17 = "Mobile Compressors" + cr;
if(form1.chkused.checked == true) b18 = "Used Equipment" + cr;
if(form1.chkvariable.checked == true) b19 = "Variable Speed Compressors" + cr;
b20 = cr + "More Information" + cr + "----------------------------------------------------" + cr + cr;
b21 = form1.moreinfo.value;
parent.location.href="mailto:" + m + "?subject=" + s + "&body=" + b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9 + b10 + b11 + b12 + b13 + b14 + b15 + b16 + b17 + b18 + b19 + b20 + b21;
}
said_fox
02-03-2003, 02:30 PM
that's so nice,
but it's usefull to know the structure of the HTML form used, form1, because, it may be an element of this form is placed in the script, has no value in or definition in the HTML.
NOTE: Till this point I have no guarantee or I'm not 100% sure that I can help you to solve the problem. I tell you this to safe your time if I am being unable to do more help action for you. However, we try togather and Who Knows!
MrFluffy
02-03-2003, 02:46 PM
Here u go said_fox full html page
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
</head>
<script language="JavaScript">
function EmailForm()
{
var m = "name@test.com";
var s = "Enquiry";
var b1 = "";
var b2 = "";
var b3 = "";
var b4 = "";
var b5 = "";
var b6 = "";
var b7 = "";
var b8 = "";
var b9 = "";
var b10 = "";
var b11 = "";
var b12 = "";
var b13 = "";
var b14 = "";
var b15 = "";
var b16 = "";
var b17 = "";
var b18 = "";
var b19 = "";
var b20 = "";
var b21 = "";
var cr = "";
cr = "%0D%0A";
b1 = "Personal Information" + cr + "----------------------------------------------------" + cr + cr;
b2 = "First Name : " + form1.firstname.value + cr;
b3 = "Last Name : " + form1.lastname.value + cr;
b4 = "Address : " + form1.streetaddress.value + cr;
b5 = "City/Town : " + form1.city.value + cr;
b6 = "County : " + form1.county.value + cr;
b7 = "Postcode : " + form1.postcode.value + cr;
b8 = "Country : " + form1.country.value + cr;
b9 = "Telephone : " + form1.telno.value + cr;
b10 = "Email : " + form1.email.value + cr + cr;
b11 = "Required Information" + cr + "----------------------------------------------------" + cr + cr;
if(form1.chkscrew.checked == true) b12 = "Screw Compressors" + cr;
if(form1.chkrecip.checked == true) b13 = "Reciprocating Compressors" + cr;
if(form1.chkairtreat.checked == true) b14 = "Air Treatment" + cr;
if(form1.chktools.checked == true) b15 = "Air Tools" + cr;
if(form1.chkspare.checked == true) b16 = "Spares" + cr;
if(form1.chkmobile.checked == true) b17 = "Mobile Compressors" + cr;
if(form1.chkused.checked == true) b18 = "Used Equipment" + cr;
if(form1.chkvariable.checked == true) b19 = "Variable Speed Compressors" + cr;
b20 = cr + "More Information" + cr + "----------------------------------------------------" + cr + cr;
b21 = form1.moreinfo.value;
parent.location.href="mailto:" + m + "?subject=" + s + "&body=" + b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9 + b10 + b11 + b12 + b13 + b14 + b15 + b16 + b17 + b18 + b19 + b20 + b21;
}
// parent.location.href="mailto:" + m + "?subject=" + s + "&body=" + b;
//action="Mailto:trevorhall@proudsoft99.freeserve.co.uk?subject=Enquiry"
function Col1()
{
return (40/100) * 588
}
function Col2()
{
return (22/100) * 588
}
function Col12()
{
return Col1 + Col2
}
function Col3()
{
return (8/100) * 588
}
function Col4()
{
return (30/100) * 588
}
function Col34()
{
return Col3 + Col4
}
function Col234()
{
return Col2 + Col3 + Col4
}
</script>
<body link=blue vlink=purple>
<form method="post" Name="form1" action="Mailto:trevorhall@proudsoft99.freeserve.co.uk?subject=Enquiry">
<table border=0 cellspacing=0 cellpadding=0 width=588 Name="SDetails">
<tr>
<td colspan=4 valign=top>
<p align=center><b><font size=12>Enquiry</font></b></p>
</td>
</tr>
<tr>
<td width="javascript:Col12()" colspan=2>
<p align=center><b><font size=5>Personal Information</font></b></p>
</td>
<td width="javascript:Col34()" colspan=2>
<p align=center><b><font size=5>Required Information</font></b></p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>First name</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="firstname" width="31" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chkscrew"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Screw Compressors</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>Last name</p>
</td>
<td width="javascript:Col2()" valign=top >
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="lastname" width="31" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chkrecip"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Reciprocating</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>Street Address</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="streetaddress" width="31" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chkairtreat"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Air Treatment</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>City/Town</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="city" width="37" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chktools"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Tools</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>County</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="county" width="37" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chkspare"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Spares</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>Postal Code</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="postcode" width="37" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chkmobile"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Mobile</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>Country</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="country" width="36" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chkused"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Used Compressors</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>Telephone</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="telno" width="36" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p><INPUT TYPE="checkbox" NAME="chkvariable"></p>
</td>
<td width="javascript:Col4()" valign=top>
<p>Variable Speed</p>
</td>
</tr>
<tr>
<td width="javascript:Col1()" valign=top>
<p>E-Mail</p>
</td>
<td width="javascript:Col2()" valign=top>
<p><INPUT MAXLENGTH="50" SIZE="32" NAME="email" width="37" ></p>
</td>
<td width="javascript:Col3()" valign=top>
<p> </p>
</td>
<td width="javascript:Col4()" valign=top>
<p> </p>
</td>
</tr>
<tr style="HEIGHT: 105.3pt">
<td width="javascript:Col1()" valign=top>
<p>More Info:</p>
</td>
<td width="javascript:Col234()" colspan=3 valign=top>
<TEXTAREA style="WIDTH: 407px; HEIGHT: 134px" name="moreinfo" rows=7 cols=45></TEXTAREA>
</td>
</tr>
</table>
<table border=0 cellpadding=0 width=588>
<tr>
<td style="PADDING-RIGHT: 0.75pt; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; PADDING-TOP: 0.75pt">
<p><INPUT TYPE="submit" value="Submit"> <INPUT TYPE="reset" value=Reset></p>
</td>
</tr>
</table>
</form>
</body>
</html>
said_fox
02-03-2003, 04:34 PM
Tell this point:
I create an HTML file with your code and clicked submit, The OUTLOOK Express opened and sent the message correctly to
trevorhall@proudsoft99.freeserve.co.uk,
and the message title is:
Enquiry.
MrFluffy
02-04-2003, 02:36 AM
said_fox
Yes it does, but it sends the form as an attachment. the file is names POSTDATA.ATT.
For a user this is no good...
I wrote some script.
1) on the <form..... remove the action
2) on the submit button add ONCLICK="EmailForm()"
an error is then display???
said_fox
02-04-2003, 05:45 AM
yes this true. I'll try to send it to web based email, to see.
Also we should know why this extension "ATT" appears in the attachement.