Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash forms and asp

Status
Not open for further replies.

jlong07

Technical User
Nov 8, 2002
56
US
Hello all,

I have a problem that I have been working on to no avail for some time now. I have spent hours scouring the internet for helpful hints, but still have not been able to figure this out. I have a flash website that I want to put a form on. I have used html forms and asp for quite a while, but this is my first attempt at a flash form. I designed a movie clip that has the form in it. It consists of two parts. The first has all the form fields which are ui components. The submit button is supposed to send all the data to an asp page in the same directory as the swf. The second part is a thank you page which is supposed to be shown after the form input has been sent. Here is the action script code that I have on the submit button as well as the asp code I have in the seperate file. Thanks in advance for your help.

Actionscript:
on (release) {
loadVariablesNum("email_processor.asp", 1, "POST");
gotoAndPlay("thankyou");
}

ASP:
<% @language="VBSCRIPT" %>
<%

Dim myMail, myBody

myBody = request.form("message_txt")

Set myMail = CreateObject("CDONTS.NewMail")

myMail.BodyFormat=1
myMail.MailFormat=1
myMail.From=request.form("email_txt")
myMail.To="jason@webweaversolutions.com"
myMail.Subject=request.form("subject_txt")
myMail.Body=myBody
myMail.Send

set myMail=nothing

%>

The form has three input fields (email_txt, subject_txt, message_txt) and a submit button. The command to go to the thank you part of the form works, but the email never comes. If you would like to see it in action, go to
 
To see if the flash form was passing the appropriate info to the asp page, I commented out all of the cdonts code and inserted simple response.write commands to output the values the asp form was getting. The code looks like this.

Response.Write(request.form(email_txt))
Response.Write(request.form(subject_txt))
Response.Write(request.form(message_txt))

I changed the loadvarsnum to a geturl and I get an error that says tat the function expects a string as input. I am not sure what this means or how to fix it. I also tried changing the ui component textboxes to standard textboxes set to input text with the names I mentioned before listed in the var field.
 
Your flash code is essentially correct. I don't know anything about asp so I have to assume that your asp code for processing the forms is correct. (It would be exactly the same as if the form were on an HTML page.)

The only thing I can recommend is to fully qualify where your asp code is:

Code:
 loadVariablesNum("[COLOR=red][URL unfurl="true"]http://www.webweaversolutions.com/[/URL][/color]email_processor.asp", 1, "POST");

There's always a better way. The fun is trying to find it!
 
I have tried this also, I will try it again to see if with any of the other changes I have made it works.
 
Just for giggles, create a normal HTML page with a form that has the same fields as your flash file. In the FORM tag, make your action attribute the same as you're using here, (<form method="post" action="email_processor.asp">) fill out the form, then submit it. If your asp script works correclty, you should get an email. If no email, then your asp script has some problems.

There's always a better way. The fun is trying to find it!
 
I have already tried this and everything worked great. The problem is not with the asp code. However, I did just try changing the actionscript to geturl instead of loadvarnum to see what came up as output. I also put some response.write commands in the asp code so that it would output the values passed to the script. When I do this it says that the function expects a string as input. I am not sure what this means but it would appear to be the cause of the problem.
 
opps, just realized I already said that. Sorry.
 
In your Flash movie you have named the variable names right? Not the instance names....

Also you might want to try the loadVars() object. Specificaly loadVars.SendAndLoad().

Wow JT that almost looked like you knew what you were doing!
 
pixl8r brings up a good point. You must give each of your text fields a variable name (done in the Properties box) in order to have variables to "load".

There's always a better way. The fun is trying to find it!
 
I checked this, I have the names entered in the var field of the properties inspector. should the instance name be specified as well.
 
It's always a good idea to have instance names but it's not necessary for the script to work. Looking back on your script and the ones I use, the only difference I see is that yours is like this:

loadVariablesNum("email_processor.asp", 1, "POST");

and mine is like this:

loadVariablesNum("email_processor.asp", 0, "POST");


I don't know if this will make any difference but it's worth a try.

There's always a better way. The fun is trying to find it!
 
tviman has made a very good point as well! In fact I bet you have hit on it.

Your loadVariablesNum is loading to _level1. That's ok if you have loaded this swf onto _level1. Otherwise you should set it to 0 as he noted.

A quick test to see if this is your problem would be to add _level1 to your var names in each text field. IE _level1.emailt_txt.



Wow JT that almost looked like you knew what you were doing!
 
On further thought I need to add that the above would only relate to loading information into the flash movie. It would not relate to sending info out of the movie.

When sending the info out of the movie use try
Code:
getURL("email_processor.asp","_blank","POST");

then response.write the values to the page to make sure you are getting them.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top