Add Comment
Flex and Coldfusion Crud in 100 lines
Flex / ColdFusion Tutorial #11
Several people have emailed in requesting a simple get started CRUD example. I put together this simple example which should have the basics to get you started if your just getting into Flex and have a Coldfusion background.
Crud.mxml
I setup a simple datagrid and call my cfc to populate the columns. This example allows Create, Update and Delete of 2 simple varchar fields. On each change to the database the grid is updated.Crud.cfc
The cfc is as simple as it gets. Retrieve, update and delete. On update, insert and delete I return the query back to Flex.Demo
See this code running!
Download
Download this code as a zip!
Comments
hello guys, I'm new in this RIA development thing, and my big issue is:how to setup my flex SDK to compile my files in a way that it finds my coldfusion config files? I mean, just compile the swf and put it into de coldfusion wwwroot file is not enough?
I know about the flex builder IDE but I can't pay for that, so I use the SDK but is not working at all =].
thanks in advance guys, see ya!
montanha_auei @ Friday 20 Feb 2009 - 11:05:35 PM
I use Flexbuilder so I'm not sure with the plug in. If you are a student then you can get Flexbuilder for free https://freeriatools.adobe.com/flex for students or can can ask on http://tech.groups.yahoo.com/group/flexcoders and I'm sure someone will have some good advice.
Paul Kukiel @ Saturday 21 Feb 2009 - 01:13:10 AM
You can use the endpoint attribute of mx:RemoteObject to specify the server so you end up with something like this:
<mx:RemoteObject id="AMFService"
concurrency="single"
endpoint="http://localhost/flex2gateway/"
destination="ColdFusion"
showBusyCursor="true"
source="path.to.cfc"
result="result( event )"
fault="fault( event )">
</mx:RemoteObject>
John Whish @ Wednesday 25 Feb 2009 - 09:23:11 PM
good morning Paul, it's me again =]. today I have a question about view stack's children, could you help me please?
I am stuck in this situation =]:
<button id="root1" click="root.selectedChild=a"/>
<button id="root2" click="root.selectedChild=b"/>
<ViewStack id="root">
<child id="a">
<button id="btn1" click="root.selectedChild=b"/>
</child>
<child id="b">
<button id="btn2" click="root.selectedChild=a"/>
</child>
<ViewStack>
if I click root1 or root2 the views are displayed as it is expected, but if I click btn1
the b view is not displayed, and if I click btn2 a view is not displayed as well, the question
is: why? I mean, the buttons outside the stack works fine but the buttons inside the stack
doesn't, isn't it weird? could you show me where is the problem? thanks in advance my friend, see ya =]!
montanha @ Friday 27 Feb 2009 - 11:17:45 PM
Montanha here is a small example for you: http://flexcf.com/commentexamples/1 ( right click to view source )
Can I also suggest you join http://tech.groups.yahoo.com/group/flexcoders it is a Flex mailing list that is very helpfull.
Paul Kukiel @ Saturday 28 Feb 2009 - 02:12:04 AM
<cfset var local = {} />
throws an error.
KRAMERICA @ Thursday 09 Apr 2009 - 06:40:44 AM
Good afternoon Paul, I would like to ask you just one more thing before I finally join the tech groups at yahoo =]! could you please do a MVC version of yours crud tutorial? I've never used this pattern before so I don't know how to do it, but I believe that I really should learn it =], and to learn it I want you as my master =], can you help me one more time master Paul =]? Thanks man, bye bye.
montanha @ Thursday 09 Apr 2009 - 07:42:40 AM
<cfset var local = {} />
This line is perfectly valid, it however requires ColdFusion 8
If your on ColdFusion 7
<cfset var local = structNew() />
Dale Fraser @ Thursday 09 Apr 2009 - 10:26:41 AM
You is best! Very good tutorial!!!
Vlad @ Saturday 16 May 2009 - 12:31:55 AM
I have a problem with services-config.xml.
This example requires this configuration, doesn't it?
So, how can I configure this XML rightly?
Thanks in advance!
Toyansk @ Friday 26 Jun 2009 - 12:42:17 AM
By default the xml files will work. When you create the Flex project in FlexBuilder are you selecting ColdFusion as the server type?
Paul Kukiel @ Friday 26 Jun 2009 - 04:15:53 AM
Yes, but now the application shows the other error: [RPC Fault faultString="Unable to invoke CFC - Could not find the ColdFusion Component or Interface crud." faultCode="Server.Processing" faultDetail="For details, turn on Robust Exception Information in the ColdFusion Administrator"]
How can I solve this problem?
Thanks in advance!
Toyansk @ Friday 26 Jun 2009 - 04:54:32 AM
Put the cfc in the webroot of the webserver.
Paul Kukiel @ Friday 26 Jun 2009 - 04:57:01 AM
But the crud.cfc is in the webroot
C:\ColdFusion8\wwwroot\CrudCF-debug\, and all compiled project (swf, html,...).
Thanks!
Toyansk @ Friday 26 Jun 2009 - 05:05:05 AM
Put it here:
C:\ColdFusion8\wwwroot
so
C:\ColdFusion8\wwwroot\crud.cfc
Paul Kukiel @ Friday 26 Jun 2009 - 05:06:09 AM
Yes, it works!
Thanks a lot!
Toyansk @ Friday 26 Jun 2009 - 05:24:19 AM
I have a problem for my task,if you dont mind...can you give a tutorial how to upload picture (Browse,upload,and save it into the database) .
Thank's a lot....
Michael @ Friday 24 Jul 2009 - 01:59:37 PM
Hi, thanks for creating a great tutorial. I seem to be having a problem getting the datagrid to populate. I created a table called 'test', populated it and my dsn is ok. There is no error finding the crud.cfc. If I comment out getData() there is no error from creationComplete="ro.getData()". Any ideas? Thanks in advance for your assistance!
TonyG @ Saturday 25 Jul 2009 - 09:13:58 AM
@Tony.
Makea .cfm page and call the getData method ont he cfc and dump the result to make sure the cfc can be found and DSN is setup.
Also if you drop the CFC in the webroot you wont need to specify a com.myCompany.crud as the source it will simply be crud it might be that you have not enabled mapping for remoting on the server.
Paul @ Sunday 26 Jul 2009 - 01:26:54 AM
What is <cfquery datasource="mstest">
where is mstest set
Navindran @ Tuesday 09 Mar 2010 - 03:30:16 PM
In CFADMIN where you define a DataSource
Paul Kukiel @ Tuesday 09 Mar 2010 - 03:36:02 PM
Click button to add a comment
Author
Paul Kukiel