Dpots
02-07-2008, 10:04 PM
I am creating a email form in flash. I created a movieclip, named it form and brought it into my main timeline from the library. Within the form is four input text fields with the following variables: name, phone, email, message.
On the main timeline I put my submit button for the form with the following code:
on (release) {
if (form.name eq "" or form.phone eq "" or form.email eq "" or form.message eq "" ) {
form.gotoAndStop (3);
} else {
form.loadVariables("contact2.asp", 1, "POST");
form.gotoAndStop (2);
}
}
The button functions in that it will go to and stop on the form frame 3 if one of the fields is blank, or it will go to frame 2 of the form movieclip if all the fields are filled as I specified in my code. My problem is that the sent email does not contain the variables information.
The submit button is not within the form movieclip itself but rather on the main timeline where the form is located. I tried changing the level on the loadvariables from 1 to 0 but that didn't make a difference.) But if it is correctly going to the frame 2 and frame 3, I would think the button is speaking to the correct level.
I also did a test in which I replaced form.loadVariables("contact2.asp", 1, "POST");
with:
getURL ("contact2.asp", "", "GET");
The url address was a mile long but it DID include the variable info, so I guess it IS passing the variables, but the ASP is not outputting them in the email:
I did test the ASP using an html form with those variable names and that does work correctly.
Here is the code on the ASP page:
<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim name
Dim email
Dim phone
Dim message
' get posted data into variables
EmailFrom = "info@mydomain.com"
EmailTo = "me@yahoo.com"
Subject = "F22 Website Inquiry"
Name = Trim(Request.form("name"))
Email = Trim(Request.form("email"))
Phone = Trim(Request.form("phone"))
Message = Trim(Request.form("message"))
' validation
Dim validationOK
validationOK=true
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)
' prepare email body text
Dim Body
Body = Body & "You have received an inquiry from the Contact page on the F22 website. Below is the information submitted: " & VbCrLf
Body = Body & " " & VbCrLf
Body = Body & "Name: " & name & VbCrLf
Body = Body & "Phone Number: " & phone & VbCrLf
Body = Body & "Email: " & email & VbCrLf
Body = Body & "Message: " & message & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
%>
Any ideas/input would be greatly appreciated!
Dave
On the main timeline I put my submit button for the form with the following code:
on (release) {
if (form.name eq "" or form.phone eq "" or form.email eq "" or form.message eq "" ) {
form.gotoAndStop (3);
} else {
form.loadVariables("contact2.asp", 1, "POST");
form.gotoAndStop (2);
}
}
The button functions in that it will go to and stop on the form frame 3 if one of the fields is blank, or it will go to frame 2 of the form movieclip if all the fields are filled as I specified in my code. My problem is that the sent email does not contain the variables information.
The submit button is not within the form movieclip itself but rather on the main timeline where the form is located. I tried changing the level on the loadvariables from 1 to 0 but that didn't make a difference.) But if it is correctly going to the frame 2 and frame 3, I would think the button is speaking to the correct level.
I also did a test in which I replaced form.loadVariables("contact2.asp", 1, "POST");
with:
getURL ("contact2.asp", "", "GET");
The url address was a mile long but it DID include the variable info, so I guess it IS passing the variables, but the ASP is not outputting them in the email:
I did test the ASP using an html form with those variable names and that does work correctly.
Here is the code on the ASP page:
<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim name
Dim email
Dim phone
Dim message
' get posted data into variables
EmailFrom = "info@mydomain.com"
EmailTo = "me@yahoo.com"
Subject = "F22 Website Inquiry"
Name = Trim(Request.form("name"))
Email = Trim(Request.form("email"))
Phone = Trim(Request.form("phone"))
Message = Trim(Request.form("message"))
' validation
Dim validationOK
validationOK=true
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)
' prepare email body text
Dim Body
Body = Body & "You have received an inquiry from the Contact page on the F22 website. Below is the information submitted: " & VbCrLf
Body = Body & " " & VbCrLf
Body = Body & "Name: " & name & VbCrLf
Body = Body & "Phone Number: " & phone & VbCrLf
Body = Body & "Email: " & email & VbCrLf
Body = Body & "Message: " & message & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
%>
Any ideas/input would be greatly appreciated!
Dave