Skip to content

Instantly share code, notes, and snippets.

@mbiang
Created August 27, 2014 14:39
Show Gist options
  • Save mbiang/e3edf374c96b97b024bf to your computer and use it in GitHub Desktop.
Save mbiang/e3edf374c96b97b024bf to your computer and use it in GitHub Desktop.
Foster Group Contact Form
<!--#include file="../../includes/vbscripts/generalfunctions.asp" -->
<!--#include file="../../includes/classes/email.asp" -->
<!--#include file="../../includes/classes/validator.asp" -->
<%
' Get the http referrer without the query string
Function Referrer
Set rxp = new RegExp
rxp.Global = False
rxp.Pattern = "\?.*$"
Referrer = rxp.Replace(Request.ServerVariables("HTTP_REFERER"), "")
Set rxp = Nothing
End Function
Set vdrForm = new Validator
vdrForm.TextClass = "required"
vdrForm.TextRight = ""
bMessageSent = false
sType = compareValues(Referrer,"http://www.fostergrp.com/prospective_clients.asp","WEB REQUEST: Request for Consultation","")
sType = compareValues(Referrer,"http://www.fostergrp.com/second-opinion","WEB REQUEST: Second Opinion","")
if(Request.ServerVariables("SCRIPT_NAME") = Request("form-key"))then
sContactName = validateString(Request("name"),"")
sContactEmail = validateString(Request("email"),"")
sPhoneNumber = validateString(Request("phonenumber"),"")
sAddress = validateString(Request("address"),"")
sContactTime = validateString(Request("select"),"")
sComments = validateString(Request("comments"),"")
sType = validateString(Request("type"),"")
vdrForm.CheckEmptyString sContactName, "name", "Please enter your name"
vdrForm.CheckEmail sContactEmail, "email", "Please enter your email address", true
if(vdrForm.IsValid)then
sText = sContactName & " has sent you a contact request from your website, " & Request.ServerVariables("HTTP_HOST") & "." & vbcrlf
sText = sText & "Here is their contact information: " & vbcrlf & vbcrlf
sText = sText & "Request Type: " & sType & vbcrlf
sText = sText & "Name: " & sContactName & vbcrlf
sText = sText & "Email: " & sContactEmail & vbcrlf
sText = sText & "Best Time to Contact: " & sContactTime & vbcrlf
sText = sText & "Address: " & replace(sAddress,vbcrlf," ") & vbcrlf & vbcrlf
sText = sText & "They left the following comment: " & vbcrlf
sText = sText & """" & sComments & """"
Set oEmail = new Email
oEmail.sFromAddress = validateString(sContactEmail,"communications@fostergrp.com")
' Change the email address based on the request
If sType = "WEB REQUEST: Second Opinion" Then
oEmail.sToAddress = "communications@fostergrp.com"
Else
oEmail.sToAddress = "communications@fostergrp.com"
End If
oEmail.sSubject = sType
oEmail.sBody = sText
oEmail.iBodyType = CDW3_TEXT
oEmail.Send()
bMessageSent = true
end if
end if
%>
<%
sMenuStyles = "<style type=""text/css"">" & vbcrlf & "div#lifewealth {" & vbcrlf & "display: none;" & vbcrlf & "}" & vbcrlf & "div#insidefostergroup {" & vbcrlf & "display: none;" & vbcrlf & "}" & vbcrlf & "div#newsandresources {" & vbcrlf & "display: none;" & vbcrlf & "}" & vbcrlf & "div#medicalcommunity {" & vbcrlf & "display: none;" & vbcrlf & "}" & vbcrlf & "div#wisewealthresource {" & vbcrlf & "display: none;" & vbcrlf & "}" & vbcrlf & "</style>"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<!--#include virtual="/includes/classes/renderengine.asp" -->
<!--#include virtual="/includes/vbscripts/generalfunctions.asp" -->
<!--#include file="../../includes/classes/markupfactoryconfiguration.asp" -->
<%
Set cfgMF = new MarkupFactoryConfiguration
Set oRenderer = New RenderEngine
Set cfgMF.DBConn = oRenderer.DBConn
cfgMF.InstallID = validateNumber(Session("MarkupFactory.Installation.ID"),0)
cfgMF.Load()
oRenderer.Trace.Enabled = cfgMF.GetValue("EnableTrace")
oRenderer.InstallationID = validateNumber(Session("MarkupFactory.Installation.ID"),0)
oRenderer.RequestedPage = validateString(Request("x_markupfactory_rewrite_request"),"")
oRenderer.Filter = validateString(Request("x_markupfactory_rewrite_filter"),"")
oRenderer.RequestedPage = validateString(Request("x_markupfactory_rewrite_page"),"")
oRenderer.FullRequest = validateString(Request("x_markupfactory_rewrite_request"),"")
oRenderer.RequestMethod = validateString(Request.ServerVariables("REQUEST_METHOD"),"")
oRenderer.DoPageRequest()
oRenderer.AddHeadContent(sMenuStyles)
oRenderer.SetPageTitle("Contact Us")
%>
<%=oRenderer.HeadHTML%>
</head>
<body class="secondary">
<%=oRenderer.TemplateHeader%>
<img height="43" src="/assets/fostergroup/images/headings/contact.gif" width="569" />
<div class="dividingLine">
</div>
<p class="darkblue col">
<strong>West Des Moines Office</strong><br />
1001 Grand Avenue<br />
West Des Moines, IA 50265<br />
800-798-1012 - toll-free<br />
515-226-9000 - phone<br />
515-224-4970 - fax
</p>
<p class="darkblue col">
<strong>Omaha Office</strong><br />
8901 Indian Hills Drive, Suite 300A<br />
Omaha, NE 68114<br />
800-798-1012 - toll-free<br />
402-733-1700 - phone<br />
515-224-4970 - fax<br />
Advisor: Ross Polking - <a href="mailto:rossp@fostergrp.com">rossp@fostergrp.com</a>
</p>
<% if bMessageSent then %>
<p>Thank you for contacting us! You can expect a reply soon.</p>
<% else %>
<form action="/scripts/fostergrp/contactform.asp" method="post" id="contact">
<select name="type" id="type">
<option value="WEB REQUEST: General Inquiry"<%=compareValues(sType,"WEB REQUEST: General Inquiry","selected=""selected""","")%>>General Inquiry</option>
<option value="WEB REQUEST: Request for Consultation"<%=compareValues(sType,"WEB REQUEST: Request for Consultation","selected=""selected""","")%>>Request a Consultation</option>
<option value="WEB REQUEST: Second Opinion"<%=compareValues(sType,"WEB REQUEST: Second Opinion","selected=""selected""","")%>>Second Opinion</option>
</select>
<p>
<label>Contact Name:</label>
</p>
<input name="Name" size="35" type="text" value="<%=sContactName%>" /> <%=vdrForm.DisplayError("name")%>
<p>
<label>Email Address:</label>
</p>
<input name="Email" size="35" type="text" value="<%=sContactEmail%>" /> <%=vdrForm.DisplayError("email")%>
<p>
<label>Phone Number:</label>
</p>
<input name="Phone" type="text" value="<%=sPhoneNumber%>" />
<p>
<label>Mailing Address:</label>
</p>
<textarea cols="40" name="Address"><%=sAddress%></textarea>
<p>
<label>When is the best time to contact you?</label>
</p>
<select name="select">
<option value="Anytime"<%=compareValues(sContactTime,"Anytime","selected=""selected""","")%>>Anytime</option>
<option value="Morning"<%=compareValues(sContactTime,"Morning","selected=""selected""","")%>>Morning</option>
<option value="Afternoon"<%=compareValues(sContactTime,"Afternoon","selected=""selected""","")%>>Afternoon</option>
<option value="Evening"<%=compareValues(sContactTime,"Evening","selected=""selected""","")%>>Evening</option>
</select>
<p>
<label>Other pertinent comments:</label>
</p>
<textarea cols="40" name="Comments"><%=sComments%></textarea>
<br />
<br />
<input name="Submit" type="submit" value="Submit" />
<input type="hidden" name="form-key" value="/scripts/fostergrp/contactform.asp" id="form-key" />
</form>
<% end if %>
<%=oRenderer.TemplateFooter%>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment