View Full Version : Flash-based form to asp opens browser window...
mojoman
09-14-2004, 04:52 PM
...and I don't want it to!
I have already tried the other suggestions in the forums without success.
Using AS2.0 in MX04Pro I set up a LoadVars object that collects the information I have in a flash-based form.
I use the send() method of the loadVars obj to send out the data to an asp page that is calling the JMail service on my webserver.
I've tried many variations of the "target" parameter in the send method and while the mail does get sent out, invariably another browser window opens or I am redirected. Both of which are unacceptable.
I've also tried the sendAndLoad method as described in other forum posts and while this does not open a win or redirect - the mail is never sent which is also unacceptable.
Any suggestions greatly appreciated!!!
If you post both your Actionscript and ASP code, we can better answer your questions.
mojoman
09-15-2004, 02:06 PM
Here is my actionscript - The sendForm function is called after the form submit button is clicked and the form data is validated. Everything (AS and ASP) is working when you use "feedbackForm.send("sendmail.asp", _blank, "POST")" but this opens a window or redirects depending on target param.
function sendForm() {
feedbackForm.theName = contactMC.userName.text;
feedbackForm.theSender = contactMC.userEmail.text;
feedbackForm.theSubject = contactMC.userSubject.selectedItem.label;
feedbackForm.theMessage = contactMC.userMessage.text;
//these next lines are the variations I've tried and their commented reults - I am not using them at the same time
//-----------
feedbackForm.send("sendmail.asp", X, "POST")//any variation of the
target parameter "X"(_blank, _self, _top, "") either spawns or redirects which makes sense - leaving the target param out causes the ASP script to fail and return error in new window but only when "silent" param of ASP object is "False".
//-----------
feedbackForm.sendAndLoad("sendmail.asp")//does not redir or spawn but no mail is sent
//-----------
feedbackForm.sendAndLoad("sendmail.asp", feedbackForm, "POST")//does not redir or spawn but no mail is sent
//-----------
feedbackForm.sendAndLoad("sendmail.asp", "POST")//does not redir or spawn but no mail is sent
//-----------
gotoAndStop("correct");//goes to message that email was sent successfully
}
The ASP is as follows -
<%@ Language=VBScript %>
<%
option explicit
DIM JMail
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "myMailserver"
JMail.Silent = "true"
JMail.Sender = Request.form("theSender")
JMail.Subject = Request.form("theSubject")
JMail.AddRecipient("mojo@myRecipientEmail.com")
JMail.Body = "Message: " & Request.form("theMessage") & " Sender: " & Request.form("theName")
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Execute()
JMail.close
set jmail = nothing
%>
I've changed the server address and recipient email for privacy. The ASP code is basically what you get when you search for JMail on the net. I've used it before and it works great - except here.
Thanks in advance for any tips!!!
Mojoman
flashboy
09-15-2004, 03:56 PM
I am having similar luck (or lack of luck rather) sending data to an ASP script. I am trying to avoid new browser windows and URL redirects (which occur whenever I use the objLoadVars.send() method) and instead I am trying to use the sendAndLoad() method. Unfortunately, as I watch my network monitor I see that there is no network activity (no data is sent) when the method is called.
Any help would be appreciated.
:)
PhilB
09-15-2004, 05:10 PM
You need to use the LoadVars object with sendAndLoad. For example:
function sendForm() {
var feedbackForm:LoadVars = new LoadVars();
feedbackForm.theName = contactMC.userName.text;
feedbackForm.theSender = contactMC.userEmail.text;
feedbackForm.theSubject = contactMC.userSubject.selectedItem.label;
feedbackForm.theMessage = contactMC.userMessage.text;
feedbackForm.sendAndLoad("sendmail.asp", feedbackForm)
gotoAndStop("correct");
}
flashboy
09-15-2004, 06:41 PM
Thanks for the response PhilB,
I was using the LoadVars object, so that wasn't the problem. However, I did notice some slightly different syntax between your sample and my code, and I figured out the problem.
My incorrect syntax:
objLoadVars.sendAndLoad("theURL.asp", "objLoadVars", "POST")
Correct syntax:
objLoadVars.sendAndLoad("theURL.asp", objLoadVars, "POST")
Removing the double quotes from the "target" parameter did the trick.
:)
mojoman
09-15-2004, 07:45 PM
I too had the quotes thanks to all for the help and input!
abhiuday
02-07-2006, 06:21 AM
Thanx buddy :)
I too was facing the same problem and ur solution rocks..
Regards,
Abhi
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.