First, cat.selected is a Boolean (True/False)
You need to do a conditional to see if the check box (by id) is set to true of
false to determine its value
private function insertHandler():void{
if (cat.selected == true) {
catManager.cats("cats");
}
}
<mx:CheckBox x="100" y="73" label="Cats" id="cat"/>
Or use a switch/case if there are numerous check boxes.
Also is the path to your CFC: www.yourwebsite.com/
chkbx_dbinsert/insert.cfc?
----------------------------------------
From: "stinasius" <[email protected]>
Sent: Tuesday, August 11, 2009 6:00 AM
To: [email protected]
Subject: [flexcoders] Re: ameature question but am desperate
this is the code
"mxml file with Remote object call"
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
public function
handleStringResult(event:ResultEvent):void{
onCompleteHandler();
}
private function onCompleteHandler():void{
Alert.show("Congratulations!");
}
private function insertHandler():void{
catManager.cats(cat.selected);
}
]]>
</mx:Script>
<mx:RemoteObject id="catManager" destination="ColdFusion"
source="chkbx_dbinsert.insert" showBusyCursor="true">
<mx:method name="cats" result="handleStringResult(event)"
fault="mx.controls.Alert.show(event.fault.faultString)"/>
</mx:RemoteObject>
<mx:CheckBox x="100" y="73" label="Cats" id="cat"/>
<mx:Button x="100" y="99" label="Insert" click="insertHandler()"/>
</mx:Application>
"cfc"
<cfcomponent>
<cffunction name="cats" access="remote" returntype="string">
<cfargument name="cat" type="boolean" required="no"/>
<cfquery name="regCat" datasource="cats">
INSERT INTO cats(cat)
VALUES("#arguments.cat#")
</cfquery>
</cffunction>
</cfcomponent>