Groups | Blog | Home
all groups > macromedia flash sitedesign > july 2007 >

macromedia flash sitedesign : Can't pass variables using loadVariablesNum



bizzykehl
7/7/2007 3:53:05 PM
Hello all-
I have a form with 5 text fields, set as variables(recipient, name, email,
companyname, message). I have a submit button with the following code:
on (release) {
loadVariablesNum("http://www.uwm.edu/cgi-bin/wgkehl/FormMail.pl", 0, "POST");
}
EVERY EXAMPLE that I've read says this should work correctly, however it
doesn't!!! I have no idea what the problem is- am I missing something? I've
changed loadVariablesNum(...) to getURL(...) and that atleast sends the user to
the FormMail.pl file, but doesn't pass any of the variables. Using
loadVariablesNum doesn't seem to do much of anything (even though i understand
it's not supposed to show any redirection).

So there it is, I've used about 5 different scripts, read about 400 pages of
information telling me that I'm doing this correctly, and this forum is my last
resort. Any help or advice is appreciated. Thanks alot guys.

William
www.cerebellumsoftware.com
Rob Dillon
7/9/2007 9:19:17 AM
You'll have better luck with the loadVars object. You can use it to both
send in the data and get back a result from your CGI.

It works something like this in AS2:

yourButtonInstance.onRelease = function() {
// create an object instance for the send function...
dataToSend = new LoadVars();
// create another for the CGI result...
responseBack = new LoadVars();
// set properties for the send object...
dataToSend.userName = name;
// etc. for each variable name in your form
// write an onLoad function to get the result and use it, if you
like...
responseBack.onLoad = function(success:Boolean) {
if(success) {
// do something;
// } else {
// do something else;
}
}
// now, actually send the data...
dataToSend.sendAndLoad(""http://www.uwm.edu/cgi-bin/wgkehl/FormMail.pl",
responseBack, "POST");
}

Some points to remember:
1. this will not work locally during testing, the files must be run from
a server.
2. Be sure to empty your browser cache every time you make a change.
3. Be sure to supply the correct path to the variables that you need to
access in your dynamic text fields. If you can't write the function
locally, then use the .text property of the dynamic text field instead.
DMennenoh **AdobeCommunityExpert**
7/9/2007 9:49:05 AM
[quoted text, click to view]
1. this will not work locally during testing, the files must be run from
a server.

Maybe because you use Perl? If you use PHP and use the $_REQUEST object,
instead of $_POST then you can test locally - which is quite nice sometimes.


--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/

AddThis Social Bookmark Button