View Full Version : Form Submission LoadVars Not Getting Variable
bueller
07-16-2006, 10:59 PM
Hi, I'm kind of new to Flash Action Script, but seems like most other programming languages. I've found many tutorial on the web, and downloaded examples that work, but I can seem to get mine to work.
I'm trying to use a form to use my whois.cgi for domain name lookups. I have it working on my html page version, now just need to get the flash version to work.
When I click the button it shows this. http://www.kellywebservices.com/cgi-bin/whoisfree.cgi?dom=&tld=&action=search
and here is my code for the submitForm() Funtion.
var sender = new LoadVars();
//Set submit button handler.
go.onRelease = function() {
submitForm();
}
//Provide custom form submission function.
function submitForm() {
sender.action = "search";
sender.tld = tld.value;
sender.dom = dom.text;
sender.send("http://www.kellywebservices.com/cgi-bin/whoisfree.cgi", "_blank", "get");
}
So, when I click it, its basically passing the search because it's text, but its not getting or not passing the data from my input text field whose instance name is dom and the combobox that is actually a movie clip with intance name of tld. Can anyone help me? I've tried so many different ways including removing the function and putting it in the button and nothing. The flash is a template I bought and all the buttons and components seem to have different layers. Does this cause problems? The tutorial I downloaded has this code but only 4 layers and one frame, mine has like 113 frames.
Thanks to those that can help. But from all the tutorials I have seen, this should work.
bueller
07-16-2006, 11:53 PM
Hi, I'm kind of new to Flash 8 and Action Script, but seems like most other programming languages. I've found many tutorial on the web, and downloaded examples that work, but I can seem to get mine to work.
I'm trying to use a form to use my whois.cgi for domain name lookups. I have it working on my html page version, now just need to get the flash version to work.
When I click the button it shows this in the browser. http://www.kellywebservices.com/cgi-...&action=search
and here is my code for the submitForm() Funtion.
var sender = new LoadVars();
//Set submit button handler.
go.onRelease = function() {
submitForm();
}
//Provide custom form submission function.
function submitForm() {
sender.action = "search";
sender.tld = tld.value;
sender.dom = dom.text;
sender.send("http://www.kellywebservices.com/cgi-bin/whoisfree.cgi", "_blank", "get");
}
So, when I click it, its basically passing the search because it's text, but its not getting or not passing the data from my input text field whose instance name is dom and the combobox that is actually a movie clip with intance name of tld. Can anyone help me? I've tried so many different ways including removing the function and putting it in the button and nothing. The flash is a template I bought and all the buttons and components seem to have different layers. Does this cause problems? The tutorial I downloaded has this code but only 4 layers and one frame, mine has like 113 frames.
Thanks to those that can help. But from all the tutorials I have seen, this should work.
thephosphorbox
07-17-2006, 01:12 AM
Looks like you could have a pathing issue there with your text info box. It's not exactly clear how you have it set up.. are you using a text box to receive info from the user? Or are you using a combo box component?
If you're using a text box, try :
sender.tld = dom.text;
That will grab whatever the user has entered into that text box.
bueller
07-17-2006, 01:20 AM
Sorry for not being clear.
I have a input text box and its instance name is dom. It is used to get the domain name. like yahoo . And I have a combo box with 5 values like .com .net etc, and it's instance name is tld .
So with my coding I want the sender.dom to equal the text in the dom input text box and the sender.tld to equal the value of the item selected from the tld combo box. I thought I had the right coding. Does it look ok to you?
It just isn't passing the information and I didn't know if it is because of incorrect coding or because the the flash animation and multiple layers and keyframes for certain layers being different then others. The submit button is on a different layer then the input and combo box. Does this cause problems? Thanks for the quick response, hope this makes things more clear for all.
bueller
07-18-2006, 12:37 AM
I've tried to change instance names if they are colliding because the sender.dom and dom are similiiar, still nothing after 3 days of working on it. Any suggestions would be appreciated.
bueller
07-19-2006, 04:21 AM
any one???
bueller
08-14-2006, 03:31 AM
Still am stuck... can anyone help.
bueller
08-14-2006, 07:50 AM
Well the cgi is fine, it basically wants the inputs, i have this working perfectly on my html version, but the flash version it would work fine too if it would pass the actuall inputted text and not empty strings. The cgi looks all encrypted.
So basically, i know how to access the cgi etc, the problem i'm having is getting the info that the user inputs to the url, it is sending the variables but as empty strings, not the actual users input.
try tinkering with this line
sender.send("http://www.kellywebservices.com/cgi-bin/whoisfree.cgi", "_blank", "get");
Change "get" to "POST", if that doesnt work, change "send" to "sendAndLoad"
bueller
08-17-2006, 10:07 AM
FINALLY
It worked after another few days of trying the same things over and over...
Thanks Cota, the sendAndLoad didnt work, and the POST didn't either, but then I decided to break apart the 2 things that the data were coming from because they were combined to be a mc. After i broke them apart, then it worked perfectly.
Thanks for all those who tried to help it was much appreciated.
Tho I wonder why when they were combined to be a mc but still had instance names why the loadVars couldn't read them??? Does anyone know that one?
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.