ASP Form from Flash

Hi everyone…I hope everybody had an excellent Christmas!!! I loved the time spent with my family!!!

Anyways, I created a form in Flash to put information into a database. It works fine except for the processing page pops up everytime I submit. What do I do to stop this?

Post your Flash code, and we might be able to help :wink:

use sendAndLoad instead of just send. I had the same problem.
just use the process page to report back wether or not the info was entered correctly.

Here is the code in the flash doc:

function onClick(btn) {
if (btn == submit_btn) {
getURL("…/processForm.asp", 0, “POST”);
gotoAndStop(“thanx”);
} else if (btn == reset_btn) {
fName = “”;
lName = “”;
email = “”;
comments = “”;
}
}


sendVars = new LoadVars();
getVars = new LoadVars();
getVars.onLoad = function(success){
	if(success){
		if(this.entered == "true"){
			gotoAndStop("thanx");
		}else{
			trace("Data Entered Succesfully");
		}
	}else{
		trace("ASP Error");
	}
}
submit_btn.onRelease = function() {
	sendVars.fName = fName;
	sendVars.lName = lName;
	sendVars.email = email;
	sendVars.comments = comments;
	sendVar.sendAndLoad("../processForm.asp", getVars, "POST");
};
reset_btn.onRelease = function(){
	fName = "";
	lName = "";
	email = "";
	commments = "";
}

make sure your asp page returns a value for entered of true if the data was entered correctly and false if not.

edit: please use ’

' tags around your actionscript when posting, it makes it easier to read for us :beam:

Thanx norie, but whne I entered that code nothing happened. Am I supposed to change anything? I have been looking at it in an attempt to understand. I am pretty new at the actionscript. What exactly is this code saying and doing?

I really prefer the:

actionscript:

submit_btn.onRelease = function() {
sendVars.fName = fName;
sendVars.lName = lName;
sendVars.email = email;
sendVars.comments = comments;
sendVar.sendAndLoad("…/processForm.asp", getVars, “POST”);
};
reset_btn.onRelease = function(){
fName = “”;
lName = “”;
email = “”;
commments = “”;

It gives me a better understanding of how things work. Thank you so much for the help!

http://www.kirupa.com/developer/actionscript/forms_database.htm

I already looked at that tut, but it doesn’t tell you how to keep the window from popping up!

*Originally posted by wish7 *
**I already looked at that tut, but it doesn’t tell you how to keep the window from popping up! **

ahh but yes it does my friend, your using getURL. the tut states you should use loadvariableNum


loadVariableNum("../processForm.asp", 0, "POST"); 

I stand corrected! Thanx!

No problem, i didn’t know what you meant at first or I would have just said this from the beginning. :slight_smile:

Happy New Year!!!