sendAndLoad problems

  • Gamercjm
  • Novice
  • Novice
  • Gamercjm
  • Posts: 34
  • Loc: Murrietta, CA

Post 3+ Months Ago

Ok, so I have everything working so far exept the sendAndLoad, It works fine if i just do a send() using POST but i want it to sendAndLoad().

Code: [ Select ]
var myData = new LoadVars();
submit.onPress = function(){
    if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
        myData.id = _root.id;
        myData.to_phone = _root.to_phone;
        myData.to_name = _root.to_name;
        myData.sendAndLoad("test.php",myData,"POST");
    }
}
    
myData = new LoadVars()
myData.onLoad = function(){   
    if(this.writing=="Ok") {
        status.text = "Submited data was saved"
        gotoAndStop(42);
    } else status.text = "Error in saving submitted data";
}
stop();
  1. var myData = new LoadVars();
  2. submit.onPress = function(){
  3.     if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
  4.         myData.id = _root.id;
  5.         myData.to_phone = _root.to_phone;
  6.         myData.to_name = _root.to_name;
  7.         myData.sendAndLoad("test.php",myData,"POST");
  8.     }
  9. }
  10.     
  11. myData = new LoadVars()
  12. myData.onLoad = function(){   
  13.     if(this.writing=="Ok") {
  14.         status.text = "Submited data was saved"
  15.         gotoAndStop(42);
  16.     } else status.text = "Error in saving submitted data";
  17. }
  18. stop();


When i have it as send() it will just pop-up a new window that POST's the information. But i cant seem to get it to use sendAndLoad then go to the from 42.

PHP:

Code: [ Select ]
<?php
$cell = $_POST['to_phone'];
if( $cell != "") {
echo "writing=Ok&";
}
?>
  1. <?php
  2. $cell = $_POST['to_phone'];
  3. if( $cell != "") {
  4. echo "writing=Ok&";
  5. }
  6. ?>


Is the PHP file setup correctly to work with Flash?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

i think its better that U use 2 loadVars .

Code: [ Select ]
var SendBuffer = new LoadVars();
var RcvBuffer = new LoadVars();
  1. var SendBuffer = new LoadVars();
  2. var RcvBuffer = new LoadVars();


then

Code: [ Select ]

submit.onPress = function(){
  if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
   SendBuffer.id = _root.id;
   SendBuffer.to_phone = _root.to_phone;
   SendBuffer.to_name = _root.to_name;
   SendBuffer.sendAndLoad("test.php",RcvBuffer,"POST"); // USE RcvBuffer.
  1. submit.onPress = function(){
  2.   if(_root.id !="" && _root.to_phone !="" && _root.to_name !=""){
  3.    SendBuffer.id = _root.id;
  4.    SendBuffer.to_phone = _root.to_phone;
  5.    SendBuffer.to_name = _root.to_name;
  6.    SendBuffer.sendAndLoad("test.php",RcvBuffer,"POST"); // USE RcvBuffer.


then for received buffer .

Code: [ Select ]

RcvBuffer.onLoad = function(){    
  if(this.writing=="Ok") {
   status.text = "Submited data was saved"
   gotoAndStop(42);
  } else status.text = "Error in saving submitted data";
}
stop();
  1. RcvBuffer.onLoad = function(){    
  2.   if(this.writing=="Ok") {
  3.    status.text = "Submited data was saved"
  4.    gotoAndStop(42);
  5.   } else status.text = "Error in saving submitted data";
  6. }
  7. stop();


hope that helps

m0o
  • Gamercjm
  • Novice
  • Novice
  • Gamercjm
  • Posts: 34
  • Loc: Murrietta, CA

Post 3+ Months Ago

Hmm nope, still doesnt seem to be posting.

Does it matter if i have it sendAndLoad("http://....
like on another server, or should it still be working?
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

if you have the PHP script within the same directory of the swf file then it should be okay , otherwise u gotta specify the path .

try removing POST in

Code: [ Select ]
SendBuffer.sendAndLoad("test.php",RcvBuffer,"POST");


instead keep it this way

Code: [ Select ]
SendBuffer.sendAndLoad("test.php",RcvBuffer);


make sure of the objects paths you are using check for namin mistakes etc ...
for now try the above .

tell me exactly what happens !
  • Gamercjm
  • Novice
  • Novice
  • Gamercjm
  • Posts: 34
  • Loc: Murrietta, CA

Post 3+ Months Ago

Ugghh im gonna die.
Nope that didnt work either, I tried that but just like before once i click the button nothing happens. Im sure the .php file works for sure because i did just a regular <form> in html and that went through.

Is there any other possible way to send information to .php using POST or GET that will be hidden from the user(like not redirecting or opening a new window) and also continue playing the flash? I need it to in the middle of the flash send the information.

Timeline:
Movie...........................................................sendAndLoad.............endMovie
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

hi,

I'm having a similar problem, did you managed to find a solution?

tnx
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

well guys check if your php script works first =\ ..
don't know where the error is , do u guys have the files ?
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

well, the script works fine as long as I'm using firefox or netscape. My problems apear when I'm using IE :(
The script is in perl, not php but I don't think this is an issue here.
Tnx
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

are u sure its not a typo in flash ?
check your vars check the posts above ...
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

how can it be a typo if everything works in firefox or netscape?
i think i'm missing something.
the url, and the inputs are the same for FF of IE but still only in FF the inputs get to the server.
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

thought u r doing it from flash ..
typo in flash instance name or a variable u might have missed ..
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

the form is in flash, but this is the problem, the same swf works if it is loaded in FF pr neatscape, but fails if it is loaded by Internet Explorer...
:(
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

i hear ya which ie u using 6 ? 7 ? and which ver of flash ? 8 ?
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

I'm using (i'm not shure, right now I'm at work) IE 6 and Flash mx 2004(so this should be flash 8 ).
I have to tell you that i'm not very familiar with flash and it is possible to make stupid mistakes. evenso, right now i'm quite shure this is not the case... the action script is quite simple and as I said, it works fine if I use FF or netscape.
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

let me describe my problem in more detail:
i have to "make it work" a page that sends an email from a flash form.
i have a form with a few fields and I use a perl script to send the mail.
my biggest problem is that I don't have access to the perl script or at the logs of the server where this site is located, so I don't realy have the posibility to debug.
I had problems using some of the available functions like loadvars.send, loadvars.sendAndLoad, loadVariablesNum or loadVariables. Using any of this functions didn't get my anywhere(it doesn't work with any browser). The only way to make the post action was using getURL(url, _blank, "post").
the perl script have to recive 3 required inputs recipient="the_email_address", subject="subject_of_the_email" and required="". All other inputs from the form will be included in the email.
I was hopeing that I was overlooking some basic stuff but now I'm not shure about that.
tnx for your time and I hope you can help me :)
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

its prolly flash 7 since its mx2004 ...

can u send me your fla file ?
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

yes, I will send you the fla file in about half an hour( i'll be than in my lunch break).
I've found a lot of issues about POSTing from flash, but i think that these issues are related to an older version of the player. here is the link if you want to read http://www.hifi-regler.de/shop/sony/sony_str-de495_b_schwarz-print.php?SID=f1321b03d47f5b633daa057c69e2af30

tnx
  • bogeangles
  • Newbie
  • Newbie
  • bogeangles
  • Posts: 8

Post 3+ Months Ago

I don't know how to upload a file here, but I think it is irrelevent, I've created a servlet that displays all paramaters and headers from the request. The fields are all and ok (in both browsers IE and FF), the only major difference is that in IE the "referer" header is missing.
It is possible that the admins check for this header and because it is missing the request is droped...
  • dkardell
  • Newbie
  • Newbie
  • dkardell
  • Posts: 11

Post 3+ Months Ago

Did you ever get to find out why the sendAndLoad error was happending in a forum discussion you had last year? I too can get .send to work just find but don't want a new instance of the browser to pop up so I want to use sendAndLoad, however the PHP never gets call (and works just fine when I call the PHP in a browser).

Let me know if you found anything. Thanks!

Dan
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

depends how you use the sendAndLoad methods. Show your work to the world :P
  • dkardell
  • Newbie
  • Newbie
  • dkardell
  • Posts: 11

Post 3+ Months Ago

function sendForm() {
var my_lv:LoadVars = new LoadVars();
var result_lv:LoadVars = new LoadVars();
my_lv.fName = fname.text;
my_lv.fCompany = company.text;
my_lv.fAddress = address.text;
my_lv.fPhone = phone.text;
my_lv.fEmail = email.text;
my_lv.fInterest = interest.text;
my_lv.fSubject = subject.text;
result_lv.onLoad = function(success:Boolean) {
if (success) {
status_txt.text = result_lv.welcomeMessage;
} else {
status_txt.text = "Error connecting to server.";
}
};
my_lv.sendAndLoad("email.php", result_lv,"_POST");

status_txt.text = "Thank you. You will be contacted soon... ";
};
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

1st ... next time you post code, place it inside a code tag. See the advanced replay options.
2nd: my_lv.sendAndLoad("email.php", result_lv,"_POST"); -> replace "_POST" with "POST"
3rd: make sure that in your email.php file you have something like:
echo "welcomeMessage=some text here confirming or infirming the send of the mail";
  • mdogbender
  • Born
  • Born
  • mdogbender
  • Posts: 1

Post 3+ Months Ago

I'm having the same problem. Here is my code

Code: [ Select ]
var marketInfo:LoadVars = new LoadVars();
var retInfo:LoadVars = new LoadVars();
var headers = ["Content-Type", "text/html; charset=UTF-8"];
function submitToSFDC(answer:String){
    marketInfo.contentType = "text/html; charset=UTF-8";
    marketInfo.addRequestHeader(headers);
    marketInfo.submit = "Submit Query";
    marketInfo.debug = 1;
    marketInfo.debugEmail = "myemail@gmail.com";
    marketInfo.oid = "sfcid";
    marketInfo.retURL = "http://inflowential.com";
    marketInfo.lead_source = "Inflow Marketing Website";
    marketInfo["00N40000001UcqT"] = answer;
    if(answer=="other"){ marketInfo["00N40000001Ucso"] = other_txt.text;}
//    other_txt.text = answer;
    marketInfo.sendAndLoad("https://www.salesforce.com/servlet/servlet.WebToLead",retInfo,"POST");
}
  1. var marketInfo:LoadVars = new LoadVars();
  2. var retInfo:LoadVars = new LoadVars();
  3. var headers = ["Content-Type", "text/html; charset=UTF-8"];
  4. function submitToSFDC(answer:String){
  5.     marketInfo.contentType = "text/html; charset=UTF-8";
  6.     marketInfo.addRequestHeader(headers);
  7.     marketInfo.submit = "Submit Query";
  8.     marketInfo.debug = 1;
  9.     marketInfo.debugEmail = "myemail@gmail.com";
  10.     marketInfo.oid = "sfcid";
  11.     marketInfo.retURL = "http://inflowential.com";
  12.     marketInfo.lead_source = "Inflow Marketing Website";
  13.     marketInfo["00N40000001UcqT"] = answer;
  14.     if(answer=="other"){ marketInfo["00N40000001Ucso"] = other_txt.text;}
  15. //    other_txt.text = answer;
  16.     marketInfo.sendAndLoad("https://www.salesforce.com/servlet/servlet.WebToLead",retInfo,"POST");
  17. }


Works great with just send. Doesn't work at all with sendAndLoad. I've tried putting it on the server to run it instead of just running it from within flash. No luck.

I was trying to add the referrer header mentioned in this thread, but not sure what the value should be.

What is different between send() and sendAndLoad() so that it would not work?
  • Delirious
  • Born
  • Born
  • Delirious
  • Posts: 2

Post 3+ Months Ago

The answer to sendAndLoad not working is simply a matter of order, e.g

Submit.onRelease=function() {
  • Delirious
  • Born
  • Born
  • Delirious
  • Posts: 2

Post 3+ Months Ago

The answer to sendAndLoad not working is simply a matter of order, e.g

Submit.onRelease=function() {
var lvo=new LoadVars();
lvo.srchitm=srch.text;
lvo.sendAndLoad("http://localhost/srch.php", lvo, "POST");
}

will not work, whereas

var lvo=new LoadVars();

Submit.onRelease=function() {

lvo.srchitm=srch.text;
lvo.sendAndLoad("http://localhost/srch.php", lvo, "POST");
}

will work!

Post Information

  • Total Posts in this topic: 25 posts
  • Users browsing this forum: No registered users and 18 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.