Question
.send v .sendAndLoad
Hi all,
I have a simple sendForm(); function that compiles vars, builds a form in AS2 and sends the form to a CGI script on the host ISP for email delivery. I use the LoadVars object to collect and send the vars to the CGI script. The final part of the function sends the data to a URL and targets a blank window for a return message and uses the POST method. All works fine when the form is submitted using a simple button and the .send method of the LoadVars class.
However, I want to prevent the default CGI script return page from appearing by preventing the browser opening a new window (or replacing the swf using _self), so I used the .sendAndLoad method and replaced the 'window' target with a gotoAndStop frame, which carries a successful deliver message.
The problem is that the form date is not posted to the URL, but the swf does advance to the gotoAndStop frame, which shows the successful delivery message. Can anyone tell me why the date is not being sent to the URL with the .sendAndLoad method?
Code:
var feedbackForm:LoadVars = new LoadVars();
function sendForm() {
feedbackForm.recipient = "info@somedomain.com";
other form constructs here
feedbackForm.sendAndLoad(" http://formmail.dreamhost.com/cgi-bin/formmail.cgi", gotoAndStop("correct"), "POST");
}
//onRelease
this.contactForm.submitBtn.onRelease = function() {
if ( form validation here) {
gotoAndStop("error");
} else {
sendForm();
}
}
This problem is vexing to say the least and it is not the first time that I have had .sendAndLoad issues. Any help is very much appreciated.
I have a simple sendForm(); function that compiles vars, builds a form in AS2 and sends the form to a CGI script on the host ISP for email delivery. I use the LoadVars object to collect and send the vars to the CGI script. The final part of the function sends the data to a URL and targets a blank window for a return message and uses the POST method. All works fine when the form is submitted using a simple button and the .send method of the LoadVars class.
However, I want to prevent the default CGI script return page from appearing by preventing the browser opening a new window (or replacing the swf using _self), so I used the .sendAndLoad method and replaced the 'window' target with a gotoAndStop frame, which carries a successful deliver message.
The problem is that the form date is not posted to the URL, but the swf does advance to the gotoAndStop frame, which shows the successful delivery message. Can anyone tell me why the date is not being sent to the URL with the .sendAndLoad method?
Code:
var feedbackForm:LoadVars = new LoadVars();
function sendForm() {
feedbackForm.recipient = "info@somedomain.com";
other form constructs here
feedbackForm.sendAndLoad(" http://formmail.dreamhost.com/cgi-bin/formmail.cgi", gotoAndStop("correct"), "POST");
}
//onRelease
this.contactForm.submitBtn.onRelease = function() {
if ( form validation here) {
gotoAndStop("error");
} else {
sendForm();
}
}
This problem is vexing to say the least and it is not the first time that I have had .sendAndLoad issues. Any help is very much appreciated.
