cdonke
06-27-2007, 05:54 PM
Hi there...
I've designed an flash that loads an ASP and send an email... I've tested the asp already and it's sending just perfect... But the flash doesnt seem to be connecting to the asp...
on (press) {
This function checks if the fields are Ok... If so, it returns TRUE, if don't
it return FALSE, a code numbe in _global.error variable, and jumps to another frame that will alert about the error...
function ConferirDados() {
// Gravar dados caso esteja algo errado...
_global.nome = form.nome.text;
_global.email = form.email.text
_global.ddd = form.ddd.text;
_global.tel = form.tel.text
_global.assunto = form.assunto.text;
_global.msgm = form.msgm.text
// Definir Global do Erro
_global.error = ""
if (form.nome.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: Nome";
dynDesc.text = "Descrição de erro: Campo vazio. Coloque seu nome.";
_global.error = 1;
return false;
}
if (form.email.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: E-Mail";
dynDesc.text = "Descrição de erro: Campo vazio. Coloque seu e-mail.";
_global.error = 2;
return false;
}
var sEMail:String = form.email.text
if (sEMail.indexOf("@") == -1 || sEMail.indexOf(".") == -1) {
gotoAndStop(57);
dynCampo.text = "Campo: E-Mail";
dynDesc.text = "Descrição de erro: E-Mail inválido.";
_global.error = 2;
return false;
}
if (form.ddd.length < 2) {
gotoAndStop(57);
dynCampo.text = "Campo: Telefone - DDD";
if (form.ddd.length == 0) {
dynDesc.text = "Descrição de erro: DDD vazio.";
} else {
dynDesc.text = "Descrição de erro: DDD inválido.";
}
_global.error = 3;
return false;
}
if (form.tel.length < 7 ) {
gotoAndStop(57);
dynCampo.text = "Campo: Telefone - Número";
if (form.tel.length == 0) {
dynDesc.text = "Descrição de erro: Telefone vazio.";
} else {
dynDesc.text = "Descrição de erro: Telefone inválido.";
}
_global.error = 4;
return false;
}
if (form.assunto.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: Assunto";
dynDesc.text = "Descrição de erro: Campo vazio. Coloque um anúncio.";
return false;
_global.error = 5;
}
if (form.msgm.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: Mensagem";
dynDesc.text = "Descrição de erro: Campo vazio. Digite uma mensagem.";
_global.error = 6;
return false;
}
return true;
}
Here the e-mail should be sent... "form" is the MC with the inputtext's
dadosOK = ConferirDados()
if (dadosOK == true) {
form.loadVariablesNum ("email.asp", 0, "GET");
} else {
gotoAndStop(57);
}
}
Here is the code in EMAIL.ASP
<%
'As informações que serão enviadas para você usando objCDOMail
Dim strNome, strEmail, strDDD, strTel, strAssunto, strMsgm, strPara
Dim objCDOMail
'Digite seu e-mail abaixo
strPara = "email@server.com"
'Esta área recupra os dados enviados por seu filme como o assunto e a mensagem
strNome = Request.QueryString("Nome")
strEmail = Request.QueryString("E-mail")
strDDD = Request.QueryString("DDD")
strTel = Request.QueryString("Telefone")
strAssunto = Request.QueryString("Assunto")
strMsgm = Request.QueryString("Mensagem")
'Aqui é montado o Corpo do E-Mail
strCorpo = "<FONT SIZE=2>Mensagem enviada pelo formulário do site às " & Time & ", no dia " & Date & ".<P>" _
& "<b>Nome:</b> " & strNome & "<P>" _
& "<b>E-Mail:</b> " & strEmail & "<P>" _
& "<b>Telefone:</b> (" & strDDD & ") " & strTel & "<P>" _
& "<b>Assunto:</b> " & strAssunto & "<P>" _
& "<b>Mensagem:</b><BR>" & strMsgm & "</FONT>"
'Enviando as informações para seu e-mail usando CDONTS.NEWMAIL
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Coloque o titulo do e-mail que você vai receber
objCDOMail.From = strNome & "<" & strEmail & ">"
objCDOMail.To = strPara
objCDOMail.Subject = "Via site: " & strAssunto
objCDOMail.bodyFormat = 0
objCDOMail.mailFormat = 0
objCDOMail.Body = strCorpo
objCDOMail.Send
Set objCDOMail = Nothing
'Responder ao Flash que houve sucesso...
Response.Write "true"
%>
I still have some questions...
1) What's the diference between LoadVariables and LoadVariablesNum??
2) How can I retrieve the ASP response in flash??? I mean... When send is clicked, i want to open a flash pop-up telling that the e-mails is being sent... But how can I know when it has already been sent to alert that it was sucessfull?
Sorry for the lenght of the message, and tks in advance...
Chris.
Note: The codes are commented in Portuguese... Ask me if something is needed...
I've designed an flash that loads an ASP and send an email... I've tested the asp already and it's sending just perfect... But the flash doesnt seem to be connecting to the asp...
on (press) {
This function checks if the fields are Ok... If so, it returns TRUE, if don't
it return FALSE, a code numbe in _global.error variable, and jumps to another frame that will alert about the error...
function ConferirDados() {
// Gravar dados caso esteja algo errado...
_global.nome = form.nome.text;
_global.email = form.email.text
_global.ddd = form.ddd.text;
_global.tel = form.tel.text
_global.assunto = form.assunto.text;
_global.msgm = form.msgm.text
// Definir Global do Erro
_global.error = ""
if (form.nome.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: Nome";
dynDesc.text = "Descrição de erro: Campo vazio. Coloque seu nome.";
_global.error = 1;
return false;
}
if (form.email.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: E-Mail";
dynDesc.text = "Descrição de erro: Campo vazio. Coloque seu e-mail.";
_global.error = 2;
return false;
}
var sEMail:String = form.email.text
if (sEMail.indexOf("@") == -1 || sEMail.indexOf(".") == -1) {
gotoAndStop(57);
dynCampo.text = "Campo: E-Mail";
dynDesc.text = "Descrição de erro: E-Mail inválido.";
_global.error = 2;
return false;
}
if (form.ddd.length < 2) {
gotoAndStop(57);
dynCampo.text = "Campo: Telefone - DDD";
if (form.ddd.length == 0) {
dynDesc.text = "Descrição de erro: DDD vazio.";
} else {
dynDesc.text = "Descrição de erro: DDD inválido.";
}
_global.error = 3;
return false;
}
if (form.tel.length < 7 ) {
gotoAndStop(57);
dynCampo.text = "Campo: Telefone - Número";
if (form.tel.length == 0) {
dynDesc.text = "Descrição de erro: Telefone vazio.";
} else {
dynDesc.text = "Descrição de erro: Telefone inválido.";
}
_global.error = 4;
return false;
}
if (form.assunto.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: Assunto";
dynDesc.text = "Descrição de erro: Campo vazio. Coloque um anúncio.";
return false;
_global.error = 5;
}
if (form.msgm.length == 0) {
gotoAndStop(57);
dynCampo.text = "Campo: Mensagem";
dynDesc.text = "Descrição de erro: Campo vazio. Digite uma mensagem.";
_global.error = 6;
return false;
}
return true;
}
Here the e-mail should be sent... "form" is the MC with the inputtext's
dadosOK = ConferirDados()
if (dadosOK == true) {
form.loadVariablesNum ("email.asp", 0, "GET");
} else {
gotoAndStop(57);
}
}
Here is the code in EMAIL.ASP
<%
'As informações que serão enviadas para você usando objCDOMail
Dim strNome, strEmail, strDDD, strTel, strAssunto, strMsgm, strPara
Dim objCDOMail
'Digite seu e-mail abaixo
strPara = "email@server.com"
'Esta área recupra os dados enviados por seu filme como o assunto e a mensagem
strNome = Request.QueryString("Nome")
strEmail = Request.QueryString("E-mail")
strDDD = Request.QueryString("DDD")
strTel = Request.QueryString("Telefone")
strAssunto = Request.QueryString("Assunto")
strMsgm = Request.QueryString("Mensagem")
'Aqui é montado o Corpo do E-Mail
strCorpo = "<FONT SIZE=2>Mensagem enviada pelo formulário do site às " & Time & ", no dia " & Date & ".<P>" _
& "<b>Nome:</b> " & strNome & "<P>" _
& "<b>E-Mail:</b> " & strEmail & "<P>" _
& "<b>Telefone:</b> (" & strDDD & ") " & strTel & "<P>" _
& "<b>Assunto:</b> " & strAssunto & "<P>" _
& "<b>Mensagem:</b><BR>" & strMsgm & "</FONT>"
'Enviando as informações para seu e-mail usando CDONTS.NEWMAIL
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Coloque o titulo do e-mail que você vai receber
objCDOMail.From = strNome & "<" & strEmail & ">"
objCDOMail.To = strPara
objCDOMail.Subject = "Via site: " & strAssunto
objCDOMail.bodyFormat = 0
objCDOMail.mailFormat = 0
objCDOMail.Body = strCorpo
objCDOMail.Send
Set objCDOMail = Nothing
'Responder ao Flash que houve sucesso...
Response.Write "true"
%>
I still have some questions...
1) What's the diference between LoadVariables and LoadVariablesNum??
2) How can I retrieve the ASP response in flash??? I mean... When send is clicked, i want to open a flash pop-up telling that the e-mails is being sent... But how can I know when it has already been sent to alert that it was sucessfull?
Sorry for the lenght of the message, and tks in advance...
Chris.
Note: The codes are commented in Portuguese... Ask me if something is needed...