%
const numFields = 13
dim errorArray(), objCDO
redim preserve errorArray(numFields)
state = "Select from List"
if Request.Form("isSubmitted") = "yes" then
first_name = Request.Form("first_name")
last_name = Request.Form("last_name")
title = Request.Form("title")
organization = Request.Form("organization")
street = Request.Form("street")
city = Request.Form("city")
state = Request.Form("state")
zip_code = Request.Form("zip_code")
country = Request.Form("country")
telephone = Request.Form("telephone")
fax = Request.Form("fax")
e_mail = Request.Form("e_mail")
comments = Request.Form("comments")
ErrorMsg = ""
dim re, results
set re = New RegExp
'First Name
re.Pattern = "^[^0-9\/><\.,\\!\^\$\*\+\?@#%&\(\);:\[\]\{\}=""']+$"
re.Global = True
re.IgnoreCase = True
results = re.Test(first_name)
if results then
errorArray(0) = "False"
else
errorArray(0) = "True"
ErrorMsg = ErrorMsg & "First Name
"
end if
'Last Name
if Len(last_name) = 0 then
errorArray(1) = "True"
ErrorMsg = ErrorMsg & "Last Name
"
end if
'Title
if Len(title) = 0 then
errorArray(2) = "False"
else
re.Pattern = "^[^0-9\/><\.,\\!\^\$\*\+\?@#%&\(\);:\[\]\{\}=""']+$"
results = re.Test(title)
if results then
errorArray(2) = "False"
else
errorArray(2) = "True"
ErrorMsg = ErrorMsg & "Title
"
end if
end if
'Zip Code
if Len(zip_code) = 0 then
errorArray(7) = "False"
else
re.Pattern = "^\d{5}(-\d{4})?$"
results = re.Test(zip_code)
if results then
errorArray(7) = "False"
else
errorArray(7) = "True"
ErrorMsg = ErrorMsg & "Zip Code
"
end if
end if
'Telephone
re.Pattern = "^\d{3}-\d{3}-\d{4}$"
results = re.Test(telephone)
if results then
errorArray(9) = "False"
else
errorArray(9) = "True"
ErrorMsg = ErrorMsg & "Telephone Number- xxx-xxx-xxxx
"
end if
'Email
re.Pattern = "^\w+@\w+\.\w+"
results = re.Test(e_mail)
if results then
errorArray(11) = "False"
else
errorArray(11) = "True"
ErrorMsg = ErrorMsg & "Email Address
"
end if
'Here is where we insert new code to invoke CDONTS
'This line invokes the object using the name objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = e_mail 'That's to George :)
objCDO.To = "families@familywellness.com" 'That's to George :)
objCDO.CC = "mike@familywellness.com" 'That's to Mike :)
objCDO.Subject = "Information Request"
objCDO.Body = "Name: " & first_name & " " & last_name & ", Title: " & title & ", Organization:" _
& organization & vbCrLF & "Address: " & street & ", " & city & ", " & state & " " & zip_code _
& vbCrLF & "Country: " & country & vbCrLF & "Telephone: " & telephone & ", Fax: " & fax & vbCrLF _
& "EMail: " & e_mail & vbCrLF & comments
objCDO.BodyFormat = 1
objCDO.MailFormat = 1
objCDO.Send
Set objCDO = nothing
end if
%>
|
|
<% if ErrorMsg <> "" then %> <%= ErrorMsg %> <% end if %> |