| <%
'ASP code will determine if the form was submitted.
if request.Form("IsPostBack") = "posted" then
'Routine to send the form information. Found after
'HTML form.
call SendFormMail()
'Options for after the form is submitted.
'
'*********************************************************
'Option 1) '*
'If you wish to have no pop-up window and have the '*
'message be display on the same page un-comment the '*
'call ThankYou() line and comment out the '*
'call RedirectPage() line. Also in the '*
'jsFormValidater.js file comment out the line in the '*
'FormValidate function that start out window.open by '*
'placeing 2 forward slashes, (//) in front of it. '*
' '*
'Routine to display editable thank you message. Found '*
'after the SendFormMail routine. '*
call ThankYou()
'*********************************************************
'Option 2)
'If you wish to have the pop-up window and redirect the '*
'page un-comment the call RedirectPage() line and also '*
'un-comment the window.open line in the '*
'jsFormValidater.js file in the FormValidate function. '*
'Then comment out the call ThankYou() line. '*
'*********************************************************
' '*
'Routine to redirect the page to some other location. '*
'call RedirectPage()
'*********************************************************
else
dim arrPostLocation 'Will become array object
dim PostLocation 'Assigned page this code is inserted to.
'Gets the page that this file is instered to so that we get
'correct post back and avoid error with losing the page where
'the form is to be posted to.
arrPostLocation = split(request.ServerVariables("URL"), "/")
'arrPostLocation is split apart at each forward slash.
'Since the page that this code is inserted to is the
'last element in the array, but we have no idea how
'many elements there are we determine the last element
'in the array with the ubound function. This will
'return the page we need for the form action.
PostLocation = arrPostLocation(ubound(arrPostLocation))
%>
<%
'************************************************************************
'* Information about the form template *
'* *
'* 1) If a form tag is to be required indicate it by typing *
'* "required" in for the id property of the tag. *
'* *
'* 2) Form tags that will deal with information such that of email, *
'* phone, and zipcode MUST have either phone, email or zipcode *
'* within the name property of the tag ie (txtEmail, email, *
'* txtPhone, FaxPhone). This is for proper validation of the *
'* elements. *
'************************************************************************
%>
<%
end if
%>
<%
sub SendFormMail()
dim oMail 'Mail object
dim sTo 'Editable variable to send form to.
dim sFrom 'Users email address
dim sCC 'Used to add additional emails
dim sBCC 'Used to add additional emails
dim sSubject 'Editable subject of email.
dim sMessage 'Form data will be placed in variable.
'Initialize the Mail object variable.
set oMail = server.CreateObject("CDO.Message")
'Initialize the variables here
sTo = "bbcmidd@sunlink.net"
sCC = ""
sBCC = ""
sSubject = "Beavertown Block Estimator"
'***************************************************
'NOTE: Place the name of the forms element that '*
' you have set as the primary email between '*
' the double quotes. '*
'****************************************************
if trim(request.Form("txtEmail")) <> "" then
sFrom = request.Form("txtEmail")
else
sFrom = "requestinfo@beavertownblock.com" ' Place replacement email between quotes
end if
'****************************************************
'************************************
'DO NOT CHANGE THIS VARIABLE HERE! '*
'************************************
sMessage = ""
'************************************
with oMail
.to = sTo
.from = sFrom
.subject = sSubject
'Determine if CC and/or BCC are being used.
if len(trim(sCC)) <> 0 then
.cc = sCC
end if
if len(trim(sBCC)) <> 0 then
.bcc = sBCC
end if
'**********************************************************************
'NOTE: '*
'The following code will place the form data into the message '*
'in the followng format. '*
' '*
'FormElementName=Value&FormElementName=Value '*
'ie. txtEmail=someone@domain.com&txtFirstName=someone '*
' '*
'If you wish to make the message more readable comment the following '*
'code out and use the code that is commented out after it following '*
'instructions. '*
'**********************************************************************
'sMessage = request.Form
'**********************************************************************
'**********************************************************************
'Simply copy and paste the code below that is commented out and '*
'replace the words in the double quotes. '*
'READABLE IDENTIFIER = Something like First Name, Last Name, etc. '*
'FORM_ELEMENT = The name property of a form element tag. '*
' '*
'A side note vbcrlf stands for carriage return line feed so the the '*
'next value that you would assign is placed on the following line. '*
'**********************************************************************
sMessage = sMessage & "Foundation: " & request.Form("Foundation") & vbcrlf
sMessage = sMessage & "Walk: " & request.Form("Walk") & vbcrlf
sMessage = sMessage & "Veneer Wall: " & request.Form("VeneerWall") & vbcrlf
sMessage = sMessage & "Driveway: " & request.Form("Driveway") & vbcrlf
sMessage = sMessage & "Above Grade Walls: " & request.Form("AboveGradeWalls") & vbcrlf
sMessage = sMessage & "Patio: " & request.Form("Patio") & vbcrlf
sMessage = sMessage & "Frost Wall: " & request.Form("Frost Wall") & vbcrlf
sMessage = sMessage & "Other: " & request.Form("Other") & vbcrlf
sMessage = sMessage & "Other Description: " & request.Form("Other1") & vbcrlf
sMessage = sMessage & "Standard CMUs: " & request.Form("StandardCMUs") & vbcrlf
sMessage = sMessage & "Standard Scored CMUs: " & request.Form("StandardScoredCMUs") & vbcrlf
sMessage = sMessage & "Textured CMUs: " & request.Form("TexturedCMUs") & vbcrlf
sMessage = sMessage & "Textured Scored CMUs: " & request.Form("TexturedScoredCMUs") & vbcrlf
sMessage = sMessage & "Split Face CMUs: " & request.Form("SplitFaceCMUs") & vbcrlf
sMessage = sMessage & "Split 8 Rib CMUs: " & request.Form("Split8RibCMUs") & vbcrlf
sMessage = sMessage & "Split 6 Rib CMUs: " & request.Form("Split6RibCMUs") & vbcrlf
sMessage = sMessage & "Split 4 Rib Special CMUs: " & request.Form("Split4RibSpecialCMUs") & vbcrlf
sMessage = sMessage & "Split 4 Rib CMUs: " & request.Form("Split4RibCMUs") & vbcrlf
sMessage = sMessage & "Split 2 Rib CMUs: " & request.Form("Split2RibCMUs") & vbcrlf
sMessage = sMessage & "Split Veneer: " & request.Form("SplitVeneer") & vbcrlf
sMessage = sMessage & "Split Shadow CMUs: " & request.Form("SplitShadowCMUs") & vbcrlf
sMessage = sMessage & "Split Brick: " & request.Form("SplitBrick") & vbcrlf
sMessage = sMessage & "Sound Cell: " & request.Form("SoundCell") & vbcrlf
sMessage = sMessage & "Patio Slabs: " & request.Form("PatioSlabs") & vbcrlf
sMessage = sMessage & "Concete Pavers: " & request.Form("ConcetePavers") & vbcrlf
sMessage = sMessage & "Burnished Ground Face: " & request.Form("BurnishedGroundface") & vbcrlf
sMessage = sMessage & "Radial SRW: " & request.Form("RadialSRW") & vbcrlf
sMessage = sMessage & "Other: " & request.Form("Other2") & vbcrlf
sMessage = sMessage & "Other Style: " & request.Form("Style") & vbcrlf
sMessage = sMessage & "12 inch: " & request.Form("12inch") & vbcrlf
sMessage = sMessage & "10 inch: " & request.Form("10inch") & vbcrlf
sMessage = sMessage & "8 inch: " & request.Form("8inch") & vbcrlf
sMessage = sMessage & "6 inch: " & request.Form("6inch") & vbcrlf
sMessage = sMessage & "4 inch: " & request.Form("4inch") & vbcrlf
sMessage = sMessage & "Other Size: " & request.Form("OtherSize") & vbcrlf
sMessage = sMessage & "Other Size Desc.: " & request.Form("OtherC2") & vbcrlf
sMessage = sMessage & "Length x Width: " & request.Form("LengthxWidth") & vbcrlf
sMessage = sMessage & "Width x Height: " & request.Form("WidthxHeight") & vbcrlf
sMessage = sMessage & "Name: " & request.Form("Name") & vbcrlf
sMessage = sMessage & "Company: " & request.Form("Company") & vbcrlf
sMessage = sMessage & "Address: " & request.Form("Address") & vbcrlf
sMessage = sMessage & "City: " & request.Form("City") & vbcrlf
sMessage = sMessage & "State: " & request.Form("State") & vbcrlf
sMessage = sMessage & "Country: " & request.Form("Country") & vbcrlf
sMessage = sMessage & "Zipcode: " & request.Form("Zipcode") & vbcrlf
sMessage = sMessage & "Phone: " & request.Form("Phone") & vbcrlf
sMessage = sMessage & "Fax: " & request.Form("Fax") & vbcrlf
sMessage = sMessage & "Email: " & request.Form("Email") & vbcrlf
sMessage = sMessage & "Project Name: " & request.Form("ProjectName") & vbcrlf
sMessage = sMessage & "Project Location: " & request.Form("ProjectLocation") & vbcrlf
sMessage = sMessage & "Questions: " & request.Form("Questions") & vbcrlf
'**********************************************************************
'Assign the message string to the body of the email to be sent.
.textbody = sMessage
end with
'Send the email.
oMail.send
'Destroy the mail object
set oMail = nothing
end sub
sub ThankYou()
dim sMessage 'Editable thank you message.
'*******************************************************************
'Place whatever message you want between the double quotes. '*
'PLEASE NOTE: If you place double quote in the sting please '*
' refer to the example provided. Basically '*
' whatever you would be doube quoting place two '*
' double quotes at the being and two at the end. '*
' '*
'"something in double quotes with ""double quotes""." '*
' '*
'One more note you may place html tags in the string as well just '*
'keep in mind about the double quotes. '*
'*******************************************************************
sMessage = " Thank You for filling out the project estimator. You will receive an e-mail from us with your answers shortly. "
response.Write(sMessage)
end sub
sub RedirectPage()
dim sRedirect
'Place the page you want to redirect the browser
'to between the double quotes.
sRedirect = "index.asp"
response.Redirect(sRedirect)
end sub
%>
|