Just out of curiosity, why aren't you using flash remoting?
 
~randy

   _____  

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Sheriff
Sent: Sunday, September 30, 2007 3:52 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] HTTPService Error event





why not just use a webService, and then only show an error if something is
wrong.?


----- Original Message ----
From: George Georgiou <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Sunday, September 30, 2007 3:43:55 PM
Subject: Re: [flexcoders] HTTPService Error event





Hi Scott,
 
I have been through many Flex Tutorials but unfortunately our world lacks of
tutorials for connectivity with ColdFusion. I am an experianced CF developer
but unfortunately I cannot figure out how to proceed with data through Flex
and CF. 
 
Indeed - your way is much easier to write and better to understand than the
one that I have posted. I will keep that one :-) Thanks!
 
But still... the 'fault' function in the HTTPService tag is always
triggered! Even with your own way.
 
How can I handle this? All I want is to be able to 'alert' the users that
there is some kind of error (I know how to get the exact error message
through the event handler) but I have no clue how to trigger this function
if and only if there is some kind of problem in my CFM file. 
 
any ideas?
 
Thanks,
George


 
On 9/30/07, Scott - FastLane <HYPERLINK "mailto:[EMAIL PROTECTED]"
[EMAIL PROTECTED] com> wrote: 

George -

I have not seen this syntax for passing request params to an HTTPService.
Of course that doesn't mean it is wrong :)  But, here is how I would do it.

Change button definition to
<mx:Button label="Add Employee" click="callServer(-)"/> 
  
then

public function callServer() :void
{
    var params:Object = new Object();
    params.firstName = firstName.text;
    ...
    srv.send(params) ;
}

hth
Scott 



George Georgiou wrote: 

Hi,
 
I have this code. It works perfect but I would like to get alerted only when
I have some kind of error in my test.cfm file. Instead, the 'errorAlert(-)'
function always is triggered :(
 
Any idea's on how to make this work only when I have problems in my test.cfm
file?
 
<?xml version="1.0" encoding="utf--8"?>

<mx:Application xmlns:mx="HYPERLINK "http://www.adobe.com/2006/mxml";
\nhttp://www.adobe. com/2006/ mxml" layout="absolute"> 

    <mx:HTTPService 
      id="srv" 
      url="HYPERLINK "http://myserver.flex/test.cfm"; \nhttp://myserver.
flex/test. cfm" 
      fault="errorAlert(-) ;"
      method="POST"> 
        
        <mx:request>
            <firstName>{firstName.text}</firstName>
            <lastName>{ lastName.text}</lastName>
            <salary>{salary.text}</salary> 
            <startDate>{startDate.text}</startDate>
        </mx:request>
    </mx:HTTPService>


 <mx:Script>
  <![CDATA[
   import mx.controls. Alert;
   
   private function errorAlert() :void {
    Alert.show('-Error!');
   }
  ]]>
 </mx:Script>


    <mx:Form>
        <mx:FormItem label="First Name">
            <mx:TextInput id="firstName"-/>
        </mx:FormItem>
        <mx:FormItem label="Last Name"> 
            <mx:TextInput id="lastName"-/>
        </mx:FormItem>
        <mx:FormItem label="Salary">
            <mx:TextInput id="salary"/>
        </mx:FormItem> 
        <mx:FormItem label="Start Date">
            <mx:DateField id="startDate"-/>
        </mx:FormItem>
        <mx:FormItem>
            <mx:Button label="Add Employee" click=" srv.send()"/>
        </mx:FormItem>
    </mx:Form>

</mx:Application>









   _____  

HYPERLINK
"http://us.rd.yahoo.com/evt=51201/*http://autos.yahoo.com/new_cars.html;_ylc
=X3oDMTE5NWVzZGVyBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDYXV0b3MtbmV3Y2Fy"Ch
eck out the hottest 2008 models today at Yahoo! Autos. 



 


No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.488 / Virus Database: 269.13.35/1039 - Release Date: 9/29/2007
9:46 PM
 

Reply via email to