This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > July 2007 > Can't pass variables using loadVariablesNum





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Can't pass variables using loadVariablesNum
bizzykehl

2007-07-07, 6:16 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

2007-07-09, 6:15 pm

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.
You can write a path to that more easily.
DMennenoh **AdobeCommunityExpert**

2007-07-09, 6:15 pm

>>Some points to remember:
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/


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews