You are not passing the username and password parameters to the to the
method.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of johndoematrix
Sent: Monday, March 23, 2009 1:08 AM
To: [email protected]
Subject: [flexcoders] Re: strange problem with remote object

 

i tried to change my code after reading through some coldfusion flex
tutorials but i get the same error msg "Unable to invoke CFC - The UNAME
parameter to the userData function is required but was not passed in.". here
is my new code

"cfc function"

<cffunction name="userData" access="remote" returntype="query">
<cfargument name="uname" type="string" required="yes"/>
<cfargument name="pswd" type="string" required="yes"/>

<cfquery name="storeuserData" datasource="authentication">
SELECT *
FROM profile
where username like '%#arguments.uname#%' 
and Password like '%#arguments.pswd#%'
</cfquery> 
<cfreturn storeuserData>
</cffunction>

"mxml page"

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe. <http://www.adobe.com/2006/mxml>
com/2006/mxml" width="100%" height="100%" backgroundColor="#400000">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;

[Bindable]
private var dataAr:ArrayCollection;
private function concernOriginalReceived(event:ResultEvent):void {
dataAr = event.result as ArrayCollection;
//trace(ObjectUtil.toString(event.result.source[0].firstname));
//trace(dataAr);
}
]]>
</mx:Script>

<mx:RemoteObject id="remoteObj" destination="ColdFusion"
source="login_example3.cfc.login">
<mx:method name="userData" result="concernOriginalReceived(event)"
fault="Alert.show(event.fault.faultString,'Error');"/>
</mx:RemoteObject>

<mx:Form x="0" y="0">
<mx:FormItem label="User Name:" required="true">
<mx:TextInput id="uname"/>
</mx:FormItem>
<mx:FormItem label="Password:" required="true">
<mx:TextInput id="pswd"/>
</mx:FormItem>
<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="Email:">
<mx:TextInput id="email"/>
</mx:FormItem>
</mx:Form>
<mx:DataGrid x="285" y="0" dataProvider="{dataAr}"/> 
<mx:Button x="10" y="174" label="Button" click="remoteObj.userData();"/>
</mx:Canvas>



Reply via email to