Hi,

You are calling popCustomer(..) function just after invoke
HTTPService.send(). This wouldn't work.

HTTPService calls are asynchronous, that means you won't get result
immediately. Request is sent to server, server processes data and
returns back to client. This entire process takes some time. To be very
safe, populate the UI in result handler of HTTPService, result handler
would be called as soon as data is received in client.

See the modified code below:

<mx:Script>
<![CDATA[

var customerData = new Object;

function queryCustomer(){
if(radsession.selected == true){
queryBySession();

}

function queryBySession(){
        poster_srv.send({query_type:'querysession', sid:
txtsession.text});
}

function popCustomer(customerData){ 
        posteradminstack.selectedChild = posterpanel;
        custlname.text = customerData.customer.customerfname;   
        custlname.text = customerData.customer.customerlname;
        orderdate.text = customerData.customer.orderdate;
}

function faultHandler(faultstring, code){
var ecode = faultstring+": "+code
mx.controls.Alert.show(ecode, "fault");
}
]]>
</mx:Script> 

<mx:HTTPService id="poster_srv" 
url="http://localhost:8080/islab/poster.php"; 
fault="faultHandler(event.fault.faultstring, event.fault.faultcode)"
result="popCustomer(poster_srv.result)"
method="POST" showBusyCursor="true" useProxy="false" />


Hope that helps....


BTW! Please don't start a new thread, you could have continued
discussion in same old thread. That's how we can avoid duplicate
threads...

-abdul

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of juyalmanu
Sent: Saturday, July 02, 2005 5:31 AM
To: [email protected]
Subject: [flexcoders] XML, PHP and Flex

Hi all,
I am still stuck up with this. I am not sure if problem is with 
Httpservices or viewstacks.

I never worked with httpservices before. However after the 
suggestions in response to my previous posting. I created this..

 <mx:HTTPService id="poster_srv"    
url="http://localhost:8080/islab/poster.php"; 
  fault="faultHandler(event.fault.faultstring, 
event.fault.faultcode)"
  result="customerData=poster_srv.result"
  method="POST" showBusyCursor="true" useProxy="false" />


after the data is retrieved it was to supposed to be displayed in 
another view,(posteradminstack is the name of my ViewStack for the 
application). Then the textinput boxes are populated in the 
posterpanel. Following is the code for that

function popCustomer(){ 
posteradminstack.selectedChild = posterpanel;
custlname.text = customerData.customer.customerfname;
custlname.text = customerData.customer.customerlname;
orderdate.text = customerData.customer.orderdate;}

It is not populating the boxes. Everything on php side is fine.
given below is code snippet

<mx:Script>
<![CDATA[

var customerData = new Object;

function queryCustomer(){
if(radsession.selected == true){
queryBySession();
popCustomer();}
}

function queryBySession(){
poster_srv.send({query_type:'querysession', sid: txtsession.text});
}

function popCustomer(){ 
posteradminstack.selectedChild = posterpanel;
custlname.text = customerData.customer.customerfname;
custlname.text = customerData.customer.customerlname;
orderdate.text = customerData.customer.orderdate;
}

function faultHandler(faultstring, code){
var ecode = faultstring+": "+code
mx.controls.Alert.show(ecode, "fault");
}
]]>
</mx:Script> 

<mx:HTTPService id="poster_srv" 
url="http://localhost:8080/islab/poster.php"; 
fault="faultHandler(event.fault.faultstring, event.fault.faultcode)"
result="customerData=poster_srv.result"
method="POST" showBusyCursor="true" useProxy="false" />





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to