Reply
ASP & Javascript Form mail
Old 04-30-2008, 08:28 PM ASP & Javascript Form mail
Junior Talker

Posts: 1
Name: Don
Hi, I have a form on my companies website that people fill out for an estimate for lawn care. They type in their info, and dimensions of their lawn. When they hit 'Calculate' Javascript calculates and presents them with their estimate, but how can I get the inputed fields to be mailed to us? So in other words, when they hit calculate, it calculates and sends the info back to us (Maybe a multiple onClick event?)

Here is my code:

<form name="ff1" method="post" action="gdform.asp">
<input type="hidden" name="subject" value="Estimate Request" />

<table border="0" cellspacing="2" cellpadding="2" width="220">
<tr class="main"><td>First Name:&nbsp;</td><td><input name="fname" class="txt" size="15" value=""></td></tr>
<tr class="main"><td>Last Name:&nbsp;</td><td><input name="lname" class="txt" size="15"></td></tr>
<tr class="main"><td>Street #:&nbsp;</td><td><input name="streetN" class="txt" size="15"></td></tr>
<tr class="main"><td>Street Name:&nbsp;</td><td><input name="streetName" class="txt" size="15"></td></tr>
<tr class="main"><td>Postal Code:&nbsp;</td><td><input name="PostalCode" class="txt" size="15"></td></tr>
<tr class="main"><td>City:&nbsp;</td><td><input name="City" class="txt" size="15"></td></tr>
<tr class="main"><td>Phone:&nbsp;</td><td><input name="phone" class="txt" size="15"></td></tr>
<tr class="main"><td>Email:&nbsp;</td><td><input name="email" class="txt" size="15"></td></tr>
<tr class="main"><td colspan="2"><b class="green">Property size</b></td></tr>
<tr class="main"><td align="right">Length</td><td><input name="lenght" class="txt" size="5"> fit</td></tr>
<tr class="main"><td align="right">Width</td><td><input name="width" class="txt" size="5"> fit</td></tr>
<tr><td colspan="2" align="right"><input name="Submit" type="submit" class="but" style="background-image:url(img/button_bg2.jpg); border:0px; width:90px; height:19px;" value="Submit",>
<input type="hidden" name="sub" />&nbsp;&nbsp;</td></tr>
<tr><td colspan="2"><div id="showPrices"></div></td></tr></table></form>

<script type="text/javascript" language="javascript">

function checkField1(){var ref; var msg;//alert();
var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.[a-zA-Z]{2,3})+$/;
ref=true;
msg="Next field is required:\n";
if(Trim(document.ff1.fname.value)==''){msg+=" - Name\n"; ref=false;}
if(Trim(document.ff1.lname.value)==''){msg+=" - Last Name\n"; ref=false;}

if(Trim(document.ff1.streetN.value)=='') {msg+=" - Street #\n"; ref=false;}
if(Trim(document.ff1.streetName.value)=='') {msg+=" - Street Name\n"; ref=false;}
if(Trim(document.ff1.PostalCode.value)=='') {msg+=" - Postal Code\n"; ref=false;}
if(Trim(document.ff1.City.value)=='') {msg+=" - City\n"; ref=false;}


//if(Trim(document.ff1.address.value)==''){msg+=" - Address\n"; ref=false;}
//if(Trim(document.ff1.stateCode.value)==''){msg+=" - Province\n"; ref=false;}
//if(Trim(document.ff1.countryCode.value)==''){msg+= " - Country\n"; ref=false;}
//if(Trim(document.ff1.zip.value)==''){msg+=" - Postal Code\n"; ref=false;}
if(Trim(document.ff1.phone.value)==''){msg+=" - Phone\n"; ref=false;}
if(!re.test(document.ff1.email.value)){msg+=" - Email is wrong\n"; ref=false;}
if(document.ff1.priceR[0].checked==false && document.ff1.priceR[1].checked==false && document.ff1.priceR[2].checked==false)
{msg+=" - Select package\n"; ref=false;}
//if(Trim(document.ff1.email.value)==''){msg+=" - Username\n"; ref=false;}
if(ref){
e='Update';
document.ff1.action='gdform.asp';//https://
document.ff1.submit();
}
else {alert(msg);return false;} }
</script>
Drone-7 is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Old 05-03-2008, 03:29 AM Re: ASP & Javascript Form mail
chrishirst's Avatar
Super Moderator

Posts: 10,783
Location: Blackpool. UK
do the calculations server side and concatenate them into the email body.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Sponsored Links (We share ad revenue):
 
Reply     « Reply to ASP & Javascript Form mail
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML


Page generated in 0.12094 seconds with 15 queries