Click to See Complete Forum and Search --> : Form problem..


absolutmgd13
01-22-2007, 10:37 AM
Heres my problem, the formmailer i have does the job but for some reason when i get the return email from it...there will either be multiple answers from the same input field and some will be on there own line and others will be clutered all together. I've checked the form itself on the page and its fine nothing different about the fields that would do this. Any ideas!? Thanks!

if you want to see the form itself check here:
http://www.deadlinedelivery.net/secure/order.asp
user:client
pass:ddasap01



FormMailer:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>
<%
If len(Request.Form("Subject")) > 2 then
response.write Request.Form("Subject")
else
response.write "Form Results"
end if
%>
</title>
</head>
<body>
<%

'Dim variables
Dim ValidForm,ReturnLink,ReturnLinkName,RespondText,RespondEmail,Message,PrintEmpty
Dim Name,Email,Subject,ToEmail,Redirect,Required,RespondSign,Mailhost,RespondName,strEmail

'hidden fields
ToEmail = Request.Form("ToEmail")
Subject = Request.Form("Subject")
Redirect = Request.Form("Redirect")
ReturnLink = Request.Form("ReturnLink")
ReturnLinkName = Request.Form("ReturnLinkName")
ReplyText = Request.Form("ReplyText")
ReplyEmail = Request.Form("ReplyEmail")
ReplyName = Request.Form("ReplyName")
ReplySign = Request.Form("ReplySign")
ReplySubject = Request.Form("ReplySubject")

'array for hidden fields so not to print
Dim Hidden(12),HiddenCount,NumOfHidden,Print
Hidden(0) = "Subject"
Hidden(1) = "ToEmail"
Hidden(2) = "Redirect"
Hidden(3) = "ReplySign"
Hidden(4) = "ReturnLink"
Hidden(5) = "ReturnLinkName"
Hidden(6) = "ReplyText"
Hidden(7) = "ReplyEmail"
Hidden(8) = "ReplyName"
Hidden(9) = "ReplySubject"
Hidden(10) = "Submit"
Hidden(11) = "Reset"
HiddenCount = 11

'form fields for email address
Name = Request.Form("Name")
Email = Request.Form("Email")

theDay = FormatDateTime(Date,1)

'****************************START*****************************

Dim strError
Response.Buffer = True
If ScriptEngineMajorVersion < 2 Then
ReportError "Host system needs scripting engine upgrade to use this script"
End If
Set objFM = server.CreateObject("Scripting.Dictionary")
If IsObject(objFM) = False Then
ReportError "Host system lacks component(s) required by this script"
End If
Set objMailx = CreateObject("CDONTS.Newmail")
If IsObject(objMailx) = False Then
ReportError "Host system lacks component(s) required by this script"
End If
Set objMailx = Nothing

ParseForm

'check neccesary hidden fields

if len(ToEmail) < 3 Then
strError = strError & "<br>You need a recipient for the form"
End If
if IsValidEmail(ToEmail) = false then
strError = strError & "<br>You need a valid email address for the form to be recieved"
end if

'default subject
if len(Subject) < 3 then
Subject = "Processed Form"
End If

'if email and name not required then give value
if len(trim(Email)) = 0 then
Email = ToEmail
end if

If len(Name) < 1 then
Name = "Processed Form"
End If

'display errors
If Len(strError) > 0 Then
ReportError strError
response.write strError
response.write "<br><br>Use the back button on your browser to correct errors"
objFM.RemoveAll
response.end
else
Message = FormToDisplay(chr(10))
SendMail

'check for autoresponder and changes variables
If Len(ReplyText) > 0 Then
if len(trim(Email)) > 0 then
ToEmail = Email
if Len(ReplyName)>1 then Name = ReplyName end if
if Len(ReplyEmail)>1 then Email = ReplyEmail end if
if Len(ReplySubject)>1 then Subject = ReplySubject end if
Message = ReplyText &chr(10)&chr(10)&ReplySign
SendMail
else
end if
End If

'checks for redirect
If objFM.Exists("Redirect") = True Then
If Len(Redirect) > 0 Then
Response.redirect Redirect
Response.End
End If
End If

response.write FormToDisplay("<BR>")
if len(ReturnLink)>1 then
response.write "<br><br><a href="& ReturnLink &">"& ReturnLinkName &"</a>"
end if

End If

'*****************************END*****************************
%>

</body>
</html>

<%
'****************************FUNCTIONS**************************
Function ParseForm()
dim Index,Item,ReCountSave
For Index = 1 to Request.Form.count
ReCountSave = Index
If not Request.Form(Index) = "" then
For Each Item in Request.Form
If not Request.Form(Item) = "" Then
If Request.Form(Index) = Request.Form(Item) then
if ReCountSave = Index then
If objFM.Exists(Item) Then
objFM.Item(Item) = objFM.Item(Item) & "," & Request.Form(Index)
Else
objFM.Add Item,Request.Form(Index)
ReCountSave = Index+1
End If
end if
end if
End if
Next
end if
if ReCountSave = Index+1 then
Index = ReCountSave-1
end if
Next
End Function

Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = False
If Len(strEmail) > 5 Then
bIsValid = True
Else
If Instr(1, strEmail, " ") <> 0 Then
bIsValid = False
Else
If InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then
bIsValid = False
End If
End If
End If
End If
IsValidEmail = bIsValid
End Function

Function FormToDisplay(linebreak)
Dim strDisplay
strKeys = objFM.Keys
strValues = objFM.Items
For intCnt = 0 To objFM.Count -1
Print = true
For NumOfHidden = 0 to HiddenCount
if lcase(strKeys(intCnt)) = lcase(Hidden(NumOfHidden)) then
Print = false
end if
Next
if Print then
strDisplay = strDisplay & strKeys(intCnt) & " = " & strValues(intCnt) & linebreak
end if
Next
if linebreak = "<BR>" then
FormToDisplay = "<B>Message sent "&theDay&"</B>"&linebreak&linebreak&strDisplay
else
FormToDisplay = "Message sent "&theDay&linebreak&linebreak&strDisplay
end if
End Function

function SendMail()
Set objMailer = CreateObject("CDONTS.Newmail")
objMailer.From = Email
objMailer.To = ToEmail
objMailer.Subject = Subject
objMailer.Body = Message
On Error Resume Next
objMailer.Send
Set objMailer = Nothing
If Err <> 0 Then
Response.Write "<span class='errors'><B><br>Error encountered: </b>" & Err.Description &"</span>"
End If
End Function

Function ReportError(strMess)
If Len(strMess) < 1 Then
strMess = strError
End If
strError = "<span class='errors'><B>The following error(s) happened: </B><br>" & strMess &"</span>"
response.clear
end function

objFM.RemoveAll
Response.end
%>



Return email i get:

Message sent Monday, January 22, 2007

YourInfo-CompanyName = Test,Test,Test,Test YourInfo-ContactName = Test,Test,Test YourInfo-Phone = Test,Test YourInfo-JobReference# = Test <br>PickupInfo-Address =
Test2,Test2,Test2,Test2,Test2,Test2,Test2,Test2,Test2
PickupInfo-CompanyName = Test2,Test2,Test2,Test2,Test2,Test2,Test2,Test2
PickupInfo-ContactName = Test2,Test2,Test2,Test2,Test2,Test2,Test2
PickupInfo-Phone = Test2,Test2,Test2,Test2,Test2,Test2
PickupInfo-Department = Test2,Test2,Test2,Test2,Test2 PickupInfo-Floor/Suite = Test2,Test2,Test2,Test2 PickupInfo-City = Test2,Test2,Test2 PickupInfo-State = Test2,Test2 PickupInfo-Zip = Test2 DeliveryInfo-CompanyName =
Test3,Test3,Test3,Test3,Test3,Test3,Test3,Test3,Test3
DeliveryInfo-ContactName = Test3,Test3,Test3,Test3,Test3,Test3,Test3,Test3
DeliveryInfo-Phone = Test3,Test3,Test3,Test3,Test3,Test3,Test3
DeliveryInfo-Address = Test3,Test3,Test3,Test3,Test3,Test3
DeliveryInfo-Department = Test3,Test3,Test3,Test3,Test3 DeliveryInfo-Floor/Suite = Test3,Test3,Test3,Test3 DeliveryInfo-City = Test3,Test3,Test3 DeliveryInfo-State = Test3,Test3 DeliveryInfo-Zip = Test3 PackageInfo-ServiceOption = Rapid Rush RoundTrip = YES PackageInfo-DatePickup = 01/13/86 PackageInfo-TimeReady = 12:31 PackageInfo-NumberPieces = 1 PackageInfo-Dimemsion = 45cmx56cm PackageInfo-Weight = 1lb PackageInfo-Description&Delivery = TEST!!