ColdFusion Flash Forms Macromedia Developer Center article - Part 2
140 comments Posted by: LauraWe've had very good feedback from the first part of the ColdFusion Flash Forms article published at Macromedia. Thank you!
Many of you have asked when the second part is going to be published. The answer is: soon! But some readers have asked Macromedia and us to be able to see it sooner. So we decided to post it here for download until it is finally published at the Macromedia Developer Center.
Enjoy!
Update: The article has been published by Adobe, so these are the new links
The Real Estate Sample Application - Part 2: Managing Property Listings through Flash Forms
Sample files
Live example
Related posts: ColdFusion Flash Forms Macromedia Developer Center article - Part 1
Category: CFForm | ColdFusion | Flash Remoting |
140 Comments so far
Write yoursReally good stuff keep it up :)
I had Part 1 installed, and it was working fine.
I recoppied the new files over the old ones and tried to hit the index.cfm page.
Heres what i got:
Element STATESGATEWAY is undefined in a Java object of type class [Ljava.lang.String; referenced as
The error occurred in C:\JRun4\servers\cfflex\cfusion.ear\cfusion.war\realestate\index.cfm: line 6
4 :
5 : //get all states
6 : getstate = request.statesGateway.getAll();
7 :
8 : //make a query of prices
FIxed looks fantastic!
Thanks for your hard work.
In the real estate example, if no results are returned when you search for a property, how could you capture that and either : call another function or event?
I'd like to do something similar to your search functionality, but if nothing is returned in 'result', I want to create an alert that says " no records found, etc...". I haven't had any luck so far.
Thanks for any help!
I just install this new version, but Im getting an error message when trying to search or adding a new property.
This is the error message:
___________________________________________
Error: Service
realestate.services.ListingService not found.
___________________________________________
I can see the file "ListingService.cfc" in the services directory...
ANY IDEAS... THANKS!
Just a shot in the dark, but are you sure that remoting is enabled on the server? I was receiving similar errors with another app, and that was the issue, my host hadn't enabled the flash remoting gateway on my CF server.
Hope this Helps
You may be right, that could be the issue to my problem
Last week I upgrade my coldfusion 6.5 to 7.0.1 (mac os x).
Practicaly Im new to coldfusion.
Is there a way you can point me the way to see if flash remoting
is enable in my server?
Do I need to have any sort of path poting to a folder in the Administrator?
Or any other ideas?
THANKS AGAIN
My fault 100%
I place "realestate" folder inside another folder "cfapps" in my "wwwroot"; when I change the "componentPath" variable to "cfapps.realestate" everything worked fine.
THANKS FOR YOUR TIME
YOU KNOW IF MYSQL 5.0 CAN BE USE WITH THIS APP?
The "mysql.sql" file was successfully installed!
Im getting this error: "Error Executing Database Query."
is this related to mysql version?
Thanks
http://www.richinternet.de/blog/index.cfm?mode=entry&entry=DB40A25F-F614-7FEC-F79453ADCC540BA1
Thanks again for this great tutorial! I was wondering how you would handle more than one table, even better two related tables, in a set up such as this. I'm working on a wine application right now where i have wineries (1st table) that produce many wines (2nd/child table) that are used by glass or bottle (3rd/child table). My first thought was to create a seperate interface with each but seems like alot of unnecessary code. My seconde thought was to create a single form that had a grid of all wines, with an accordian below of the winery, wines, and uses, but that seems a little tricky for add/updates. How would you handle a common scenario like this in flash forms? Would love to hear your thoughts! :)
Thanks again for all your generousity!
Best regards,
David
Here is those two functions that i have:
public function setUpRemoting():Void{
<cfoutput><!--- cfoutput to be able to set the gateway dynamically. It is recommended however to write the actual gateway instead --->
var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection("http://#cgi.HTTP_HOST#/flashservices/gateway/");
var componentPath:String = "#request.componentPath#.services.menuService";
</cfoutput>
var responseHandler:Object = {};
<!--- put controls in the responseHandler's scope --->
var menuGrid:mx.controls.DataGrid = menuGrid;
<!--- handle search by default onResult function --->
responseHandler.onResult = function( results: Object ):Void {
menuGrid.dataProvider = results;
_root.setMode('add');
mx.managers.CursorManager.removeBusyCursor();
}
<!--- handle create response --->
responseHandler.create_Result = function( results: Object ):Void {
if (results.status){
menuGrid.addItemAt(0,results.item);
_root.setMode('add');
}
mx.managers.CursorManager.removeBusyCursor();
//show a message
alert(results.message);
}
<!--- handle update response --->
responseHandler.update_Result = function( results: Object ):Void {
var item:Object = results.item;
var index:Number = _root.findItem(menuGrid,'MenuItemID',item.MenuItemID);
if (results.status && index >= 0){
menuGrid.replaceItemAt(index,item);
}
mx.managers.CursorManager.removeBusyCursor();
<!--- show a message --->
alert(results.message);
}
<!--- handle remove response --->
responseHandler.remove_Result = function( results: Object ):Void {
if (results.status){
menuGrid.removeItemAt(_root.findItem(menuGrid,'MenuItemID',results.item.MenuItemID));
_root.setMode('add');
}
mx.managers.CursorManager.removeBusyCursor();
<!--- show a message --->
alert(results.message);
}
<!--- default error handler --->
responseHandler.onStatus = function( stat: Object ):Void {
<!--- if there is any error, show an alert --->
alert("Error: " + stat.description);
mx.managers.CursorManager.removeBusyCursor();
}
<!--- store service in global variable --->
form_menuItems.myGlobalObjects.menuService = connection.getService(componentPath, responseHandler );
}
and here is the other:
<!--- function that gets called when grid selection changes, used to bind other controls to grid values --->
public function menuGridChanged():Void {
if(menuGrid.selectedItem == undefined) {
setMode('add');
}
else {
setMode('edit');
}
menuGrid.setFocus();
}
I think my remoting function is right:
<!--- editing / adding a menu item --->
public function submitEdit():Void {
var editArguments:Object = {};
<!--- simple text inputs --->
editArguments.MenuItemID = edit_MenuItemID.text;
editArguments.MenuItemName = edit_MenuItemName.text;
editArguments.MenuItemDescription = edit_MenuItemDescription.text;
<!--- checkboxes --->
editArguments.MenuItemActive = edit_MenuItemActive.selected;
<!--- only make call if all required fields are supplied --->
if( mx.validators.Validator.isStructureValid(this, 'form_menuItems') ){
<!--- show clock cursor --->
mx.managers.CursorManager.setBusyCursor();
if (form_menuItems.myGlobalObjects.isEditMode) {
<!--- call service --->
form_menuItems.myGlobalObjects.menuService.updateMenuItem(editArguments);
}
else {
<!--- call service --->
form_menuItems.myGlobalObjects.menuService.createMenuItem(editArguments);
}
}
}
<!--- removing a listing --->
public function submitRemove():Void {
<!--- call service, sending the id --->
form_menuItems.myGlobalObjects.menuService.removeMenuItem(edit_MenuItemID.text);
}
Would greatly appreciate any advice.
Thanks again,
David
I modified the code and it works to a point. The gateway returns the query results to the grid. However, I can't get the form or service to pass the arguments to the query.
I've even tried hard coding the values in the ListingService component to pass to the query, but that doesn't seem to work either.
Here is my code for the service, gateway and form. Any assistance would be greatly appreciated as this is the only block I have to get this moving.
Service:
<cfargument name="teacher" required="no" type="numeric" default="0" hint="Primary key"/>
<cfargument name="fromDate" required="no" type="string" default="" hint="Search From Date" />
<!--- call a component sitting in memory (application scope) --->
Index:
function submitSearch():Void
{
<!--- get all the search criteria items --->
var searchArguments = {};
<!--- simple text input --->
searchArguments.date = search_fromDate.text;
<!--- dropdowns --->
searchArguments.teacher = search_teacher.value;
<!--- show clock cursor --->
mx.managers.CursorManager.setBusyCursor();
<!--- call service --->
Homework.myGlobalObjects.ListingService.search(searchArguments);
}
<cfreturn application.ListingGateway.search(argumentCollection=arguments) />
Thanks,
Steve
McRae
I basically want to populate a grid from a query.
Based on the users selection I then want to go grab more data from another query that joins some tables together and then bind that result to my forminputs, dropdowns etc..
How in the world do I do that? I am stumped atm.
please help me :)
Laura or Nahuel,
I have the same problem Xerrano was having.
This is the error message:
___________________________________________
Error: Service
Component.RemoteAccess.RDBMSPMAPService not found.
___________________________________________
I've done the solution Xerrano did and I am still having this problem and remoting is enabled on the server.
This is the setup of the folders under the wwwroot
wwwroot
-Component
--RemoteAccess
cfc's
-MainFolder
--SubFolder
---Folder this app
----Component
-----RemoteAccess
cfc's
RDBMSPMAPGateway
RDBMSPMAPService
I added the components under the app folder to see if this will work, but all of the remote access cfc's are under the root in a folder called component.
can you help me with this problem.
Thanks
I found the problem
can you help me with this problem.
___________________________________________
Error: CF Adapter: Service
_cf_Templates.PMAP.Component.RemoteAccess.
RDBMSPMAPService does not have method
"getSummaryResults" that matches the name
and parameters provided.
___________________________________________
I get this problem when call a component sitting in memory (application scope)
if i do not call that component and put everything in the first componet everthing works fine.
I used a helper function you wrote for the realestate app when handling selections of a cfselect dropdown, I now want to do the same thing with a cfselect listbox (size attribute used) however I am having some issues.
Heres the code I am using. I hard coded the array, so you know what I am returning, any idea what I am doing wrong, im not a AS wiz:
var Roles:Array = Array(4000, 4001, 4002);
<!--- Listbox --note using helper function from below to select right options--->
_root.selectList(_root.edit_Roles, Roles);
Helper Function:
<!--- helper function to select items in a list --->
public function selectList(select: mx.controls.List, optionsToSelect:Array):Void{
//go through every record to find the right one
for (var i:Number = 0; i < optionsToSelect.length; ++i) {
if (select.getItemAt([i]).data == optionsToSelect[i]){
select.selectedIndices = i;
break;
}
}
}
thanks!
I was looking at the wrong folders.
The way the site was setup wwwroot is not my root. my root dir is under wwwroot.
wwwroot
-component (I put my cfc's here)
-mywwwroot
--component (this is were it was looking for them)
I have build an application similar to this one, only it needs to include a login form and use session variables to ensure that the user is logged in before accessing it.
I was just wondering if anyone knows of some examples of using flash remoting and a login with session variables. I have found a couple of articles for one or the other but not both and I can't seem to get it working.
Any help would be greatly appreciated!
It all depends on your application, the amount of data you need to show for each child table, the space you have in the gui, etc. Having everything in one place is good only if it is easy to use, otherwise, it just becomes so complex nobody can use it. At this point, we are leaving the realm of coding to the realm of GUI design and usability, and we believe that GUI is one of the most important factors that can either make an application a success or a failure. Regarding complexity, Flash forms may not be the best way to handle it, as it is difficult to create panels that hide, show, move, etc. So you only have a fixed amount of space to work with. For bigger applications, I would strongly recommend to look at Flex.
David,
Can't really tell what your problem is. I would recommend you to start with the sample code that works and start modifying from there to see at what point is stops working.
Steve,
First, I am not sure if you have <cfreturn> in the index file or the service. Probably in the service where it should go because you have that part working. Anyway, assuming you have that part right, from what I see, it is sending the teacher but not the date to the service. The properties of the searchArguments object should be named the same as the component arguments. Since you are only passing 2 arguments, you can also use this to avoid using the arguments' names:
Homework.myGlobalObjects.ListingService.search( search_teacher.value,search_fromDate.text)
I would also put some trace/alert or something to see if search_teacher.value and search_fromDate.text have the correct values.
Zannie,
onload does not work as you may think. Look at this post: http://www.asfusion.com/blog/entry/knowing-when-the-cfform-data-arrives
Also, there are only a few reasons to use Flash remoting to populate data on onload, since it has the same effect as loading the data normally (specifying a query in the tag directly). Watch out for unnecessarily added complexity.
Also, try not to use cfsavecontent now that we have functions.
Regarding your second question, the problem is not that flash forms do not support user defined functions, because after the updater, they do. The problem is the scope. When declaring functions on an object directly like we do when assigning handler functions to the response handler or event listeners, they do not have access to the controls directly. The same happens with other functions, the easiest way to use them is to use _root as in _root.getURL(). There are other ways, like putting the functions into scope like we do for the other controls. Using _root is not very elegant, so I try to avoid it as much as possible.
xerrano,
Have not tried mySql 5, but I'll check to see if it is possible
Josh,
selectedIndices takes an array, not single numbers. You will have to construct a temporary array in your loop and then assign it to selectedIndices.
Janice,
You can reference session variables in your services directly. Flash sends session variables each time it makes a call.
I looked at the posting of when the data arrives and was able to solve the problem, but as you indicated that it can get a little confusing, so I elected to use the query option of the select component.
Regards to the second question that worked like a charmed. So I guess it would be best to place everything with scope to avoid _root or scoping problems.
McRae
<!--- helper function to select items in a list --->
public function selectList(select: mx.controls.List, optionsToSelect:Array, arrayLength:Number):Void{
// start first loop based on array length
var toSelect:Array = [];
for (var i:Number = 0; i < arrayLength; i++) {
//Next Loop is based on listbox index length - it has 8 indexes
//go through every record in listbox to
//find the right ones and select them
for (var z:Number = 0; z < select.length; z++) {
if (select.getItemAt([z]).data == optionsToSelect[i]){
toSelect.push(z);
}
}
}
select.selectedIndices = toSelect;
}
<!--- helper function to get items selected in a list --->
public function listResults(select: mx.controls.List, selectionMade:Array):Array {
// start first loop based on array length
var fromSelect:Array = [];
var x:Number;
for (var i:Number = 0; i < select.length; i++) {
for (var index:String in selectionMade){
if (selectionMade[index] == i){
x = select.getItemAt([i]).data;
fromSelect.push(x);
}
}
}
return fromSelect;
}
Attribute validation error for tag CFFORMITEM.
The value of the attribute TYPE, which is currently "script", must be one of the values: HRULE,HTML,TEXT,VRULE,SPACER.
The error occurred in C:\CFusionMX7\wwwroot\test\realestate\index.cfm: line 66
Called from C:\CFusionMX7\wwwroot\test\realestate\index.cfm: line 65
Called from C:\CFusionMX7\wwwroot\test\realestate\index.cfm: line 1
64 : <table id="container"><tr><td>
65 : <cfform name="RealEstateAdmin" format="flash" width="990" height="610" onload="formOnLoad()" style="themeColor:##56A1E1; marginRight:-12; background-color:##37749D;">
66 : <cfformitem type="script">
67 : public function formOnLoad():Void{
68 :
PS: I'm also very interested in how to implement the same question 'janice' asked - adding a login feature...
Thanks for you app. Its really allowed me to take cf development in another directions. I'm currently building an RIA that must create tabs in tabnavigator dynamically depending on what accountis chosen in a grid, additionally dynanic fields. I kown Flex has a createchild() function. Any way of doing this in cf7?
Any direction would helpful.
Thank you!
-Luis
yes, it is possible. I'll try to make an example when I get a chance.
stephen,
You need the CF Updater 7.01 to run this app.
Luis,
You can't use createchild, but you could use a repeater instead.
Thank you very much for sharing your code and all of your wonderful knowledge! I can't thank you enough.
I have one question for you when you have time. I tried using your format for getstate to call a getrace function in my RaceGateway component. I added the correct lines in my application.cfc file and am trying to populate a cfselect just like you did in the Real Estate app. I keep getting an error: The value returned from function getRace() is not of type query.
If the component name is specified as a return type, the reason for this error might be that a definition file for such component cannot be found or is not accessible. I've looked and looked at the code and everything appears to be spelled correctly and the variables appear to be named correctly. Do you have any suggestions of what I could be doing wrong? Thank you for your time and thanks again for all of your examples. I truly appreciate it.
My questions are first
I’m losing my record numbers from displaying when I resize my datagrid.
i.e.
with(dgListStandarsReport)
{
dataProvider = results;
selectedIndex = undefined;
setSize(610,numDataGridTableHeight);
};//End of with(dgListStandarsReport)
How do I format number in the datagrid? I using numberformat="999.99", but this is not working.
On the other hand when the bind attribute is used the date display changes but when you click on the input field the date selected is todays date.
Anyone got a fix on this?
Thanks
<cfset variables.dsn = arguments.dns />
shouldn't this state arguments.DSN?
Btw, thank you so much for the clear examples! I would never have used the Flash version of CFFORM if it hadn't been for you...
I need the ability to change results dynamically, how will I do this..
<cfformgroup type="repeater"
id="RepeaterIDName"
query="qRepaterResults"
startrow="0"
maxrows="# qRepaterResults.recordcount#"
visible="yes"
enabled="yes">
Thanks
Will this application work with the Standard Edition or do you need the Professional Edition to use the gateway service and Flash remoting?
I looked in the doc but I'm kind of confused about the answer I found :-/
Thanks,
Vincent
Obviously this works well with the developer edition but what would be needed if I'd use this technique for a client's project?
Will the standard edition be enough?
Thank you so much for this tutorial. It's awesome!
Vincent
it enables the user to come back and finish the form at a later time. I have already implemented this form using a traditional
html form. The way I implemented it in a traditional form approach is that I submit the form and save the data into
the database upon submitting it. (Each step comprises one form so there are total of 5 forms in the application.) When the user
comes back to finish filling them out, I just simply goes back to the DB and retrieve the data and pre-filling the parts the user
already filled out then continue with the rest.
Now I wanted to convert the form into flash form with Flash Remoting that will allow the using to submit and retrieve
data without leaving the form. I have arranged the form into tab interface, each tab equals to one step. There are five
tabs total. I am able to submit the form and retrieve data back using flash remoting. However, the biggest challenge I am
facing is how can I submit only parts of the form? I need to be able to distinguish which part of the form controls I am
submitting and which controls I need to validate before I submit and store data. In the traditional form, it was easy
because each step was its own form so I could only apply appropriate validations and required fields on the appropriate
appropriate form and only submit that form data to DB. However, since this flash form version is only a one, continues form
all controls will be submitted and all required fields will try to validate eventhough you are only submitting parts of it.
Does anybody have an advise on how I can make this work with the flash form using the same implementation i have in the traditional form.
thanks everyone!
Please see my blog to integrate session management into your flash form application. I think my code is what you're looking for:
http://blog.strikefish.com/index.cfm?mode=entry&entry=EC1E92BC-CF0D-5F0F-C6B1FE5B951D85A9
One minor thing however:
- when the form is submitted (add or update), is there a way to validate using alerts in addition to the error messages in the field?
Basically, I'd like to get the same function as the "onsubmit, on server"
Even though all my fields have "validateat="onsubmit, onserver", the alert box doesn't show up when validated.
I did this by adding
if( mx.validators.Validator.isStructureValid(this, 'YourFormName') ){
// do submit or remoting here
}
to the function called when the submit button is pressed. I think that will do what you are looking for.
that's what I currently have.
The problem is that the validation is made in the fields but not as an alert even if each field is assigned the "validateat:onsubmit, on server"
My understanding is that the function bypasses the "validateat" but I don't know how to call it in ActionScript.
Vincent
I used the code below and it seemed to work pretty well. Hopefully it will help you out.
if( mx.validators.Validator.isStructureValid(this, 'yourformname') ){
mx.managers.CursorManager.setBusyCursor();
var errCount:Number=0;
var errMessage="";
var isOk:Boolean=true;
if (_root.fieldname.length == 0) {
errCount=errCount+1;
errMessage=errMessage+"("+errCount+") Error message text here...";
isOk=false;
}
if (_root.2ndfieldname.length == 0) {
errCount=errCount+1;
errMessage=errMessage+"("+errCount+") Error message for 2nd field here...";
isOk=false;
}
if(not isOk) {
errMessage=errCount+" form error(s) found.\n\n"+errMessage;
alert(errMessage, "Warning");
mx.managers.CursorManager.removeBusyCursor();
}else{
//do remoting here
}
Any idea why I would be getting the following error when clicking on the 'search' button:
"Service threw an exception during method invocation: null"
Thanks!
I've been a CF developer for about 5 years now and stumbled upon this site and OH BOY did it lite a fire under my butt!
Thanx to your excellent tutorials and examples, I have whipped out an app in the past 4 days.
http://www.bytorproductions.com/projects/work/products2/
Next step, getting the bad boy to update via remote calls!
Keep up the great work!
Thank you very much for taking the time to put this tutorial and sample application together. I have learned a lot working with it this past week. Your website is so full of useful information. Your efforts are greatly appreciated!
I keep getting the following message:
Data source RealEstate could not be found.
The error occurred in C:\Inetpub\wwwroot\realestate\components\StateGateway.cfc: line 16
Called from C:\Inetpub\wwwroot\realestate\index.cfm: line 6
Called from C:\Inetpub\wwwroot\realestate\index.cfm: line 1
Called from C:\Inetpub\wwwroot\realestate\components\StateGateway.cfc: line 16
Called from C:\Inetpub\wwwroot\realestate\index.cfm: line 6
Called from C:\Inetpub\wwwroot\realestate\index.cfm: line 1
14 : <cfset var q_state = "" />
15 :
16 : <cfquery name="q_state" datasource="#variables.dsn#" cachedWithin="#CreateTimeSpan(0,2,0,0)#">
17 : SELECT state.*
18 : FROM state
I'm using CFMX7 Developers edition on my local machine. I've created my own, downloaded apps I know work, copied and pasted you name it and NOTHING using flash remoting works.
I've reinstalled CF twice now and I can not find ANYTHING about flash services gateway in the adminstrator or file structure anywhere.
Where can I look to see if in fact it is installed and if not where can I get it from. I've been a Coldfusion Developer for quite some time but these are my first efforts at Flash Remoting.
Sorry if this is completely stupid but I'm at a loss.
Thanks
"The Flash Remoting service URL does not translate to an actual directory structure on your web or application server. The URL, which ends in flashservices/gateway, specifies the web application context and gateway servlet mapping for the Flash Remoting service." http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_16319#url
myService = connection.getService("remoting.flRemote", responseHandler );
Sorry for all the posts
I get the same results when using the search button. Would anyone have any suggestions?
Thanks
Phil
Micah
First, thanks for all of the hard work on this application! It has been absolutely invaluable to me!!
I am encountering one issue with the app itself using MS Access - I receive the following error when attempting any searches: Im getting this error: "Error Executing Database Query." - everything else works.
Second issue is, you know how if you have a regular submit button, all of the messages that you enter in required fields pop up. However, using the type="button" to call the function to submit without refresh doesn't show those messages, although it highlights the required fields. How can I get the messages to display?
Thanks again!
Has anyone been able to get this to work with Access? I don't have MySQL to see if that is the issue, but when I install this right out of the gate, everything works except for the search functionality. Every time I hit the search button, I get Error Executing Database Query. I desparately need to utilize this search functionality, and trying to troubleshoot this by taking all of the queries out of the listingDAO.cfc didn't work. I see that hte search function calls the listingService.cfc which then in turn calls the listingGateway.cfc, but trying to take out the queries and params to determine where the issue is located hasn't gotten me anywhere.
BTW - what does DAO stand for in the listingDAO.cfc file?
searchArguments.bathrooms = search_bathrooms.selectedItem.data;
on the index.cfm page, the search worked! I'll have to look a little further to see why that is, but I'm so glad that I finally got it working. One less question of mine to answer :) Again, WONDERFUL job on all that you're doing here!
When using access, make sure your datasource is using Access with Unicode (as opposed as just Access), otherwise some cfqueryparams don't work.
DAO stands for Data Access Object
:)
Quick question (I hope) - I'm having some issues with having the updates, deletions and new item inserts showing up in the datagrid after posting. I've managed to get the creation, search and edit to work (mind you this is not the actual real estate application, but an application that I've been building using this as a reference).
I've been going over and over the code and am not sure what I'm missing. I have the listing grid change function there, but I'm not seeing/understanding the code in the real estate application that updates the listingGrid datagrid when something is added, edited or deleted, but it does work in your example.
Could you please give me a quick pointer as to what I should be paying attention to?
Thanks!
You might want to double check your DAO's fetch method. If you don't include all the fields that are in the grid, then they won't show up. I had the same problem because i was using a joined query in my grid and half wouldn't show up because i wasn't querying all the fields in my fetch method after my insert/update. Hope this helps!
David
I went into the fetch method, and wasn't sure exactly where I should be focusing with regard to including all the fields that are in the listingGrid. I ensured that all of the lines that have <cfset data["mls_id"] = getQuery.mls_id /> for example, all correspond to the items in the listing grid.
Do you mean that all of these cfset data lines should correspond to all of the form fields that are in the cfform in order for the real time updates and additions to reflect in the data grid?
I am able to search successfully - it is just when I make an edit or add a new record. The edit and and addition does take place in the database, it just doesn't show up in the data grid until I manually refresh the page.
Whatever fields you have in your grid, your fetch method must contain the same. I don't think that is your problem though now that you mention that when you refresh the grid has the new value. Instead, look in setUpRemoting() and make sure that your onResult, create, update and remove methods are correct. These are what update the grid once your fetch methods send data back to the service. These methods should match those that are in the service followed by _Result. Ex: serviceName_Result. In my case i have a service called createImage so when i want to get the result entered back to my grid i use the responseHandler.createImage_Result in order to have it sent to my grid:
<!--- handle create item response --->
responseHandler.createImage_Result = function( results: Object ):Void {
if (results.status){
imageGrid.addItemAt(0,results.item);
_root.setMode('add');
}
mx.managers.CursorManager.removeBusyCursor();
//show a message
alert(results.message);
}
Hope this helps,
David
I'm just windering if there is a way to see an error returned by flash form page? Is there any debuging method available for flash forms?
I pretty much disassemble your code and re-created similar application, but there are some weird point I'd like to check and can't see what's happening from CF point of view.
Thanks for any info!
now this is where my problem starts
if I alert('mailbox name:' + results[0]); then I get australia which is the mailbox region but how do i replace this statement with one using the dynamic name.
var Australia:mx.controls.DataGrid = Australia;
Australia.dataProvider = results[1];
I've tried everything but nothing works.
i.e
var results[0]:mx.controls.DataGrid = results[0];
results[0].dataProvider etc.
any ideas?
I've successfully converted this app to my own usage. However, I'm a bit at odds about changing how the ID/Primary Key is implemented, because the realestate app uses a string (MLS_ID) instead of a more typical autonumber.
I've just about caught everything except for the Create functions in ListingService and ListingDAO. Where exactly is the code that re-lists the grid, but uses the newly inserted ID only?
In other words, I don't see a re-query after the Insert SQL, because in the case of the realestate app, the primary key has basically been TYPED by the user as the MLS ID. In my application, the ID is created by the DB (MS Access), so while the app does insert the data, it still comes back with an error since the listing is not showing the newly entered listing.
I used a default (user friendly) error message inside of the CFCATCH tags and then included a cfmail tag that has all of the error information and data dumps.
Scott
http://www.macromedia.com/support/flashremoting//ts/documents/iis_gateway_connection.htm
There are three try an catch error handlers on the ListingDAO.cfc file. You can add the cfmail tag inside the <cfcatch></cfcatch> blocks.
EXP:
<cfcatch type="Any">
<cfset returnObj["status"] = false/>
<cfset returnObj["message"] = "Generic error message that you want the user to see"/>
<cfmail to="someone@email.com" from="someone@email.com" subject="Error">
#CFCATCH.message# : #CFCATCH.detail# <BR />
Then whatever generic message that you want to include. I also include the data dumps.
</cfmail>
</cfcatch>
<cfset application.listingGateway = createObject("component",variables.componentPath & ".components.ListingGateway").init(variables.dns) />
Is there a better way of doing this then in the application scope?
great site, keep up the good work!!!
If so, you can use the cfmail in there.
I also use cfmail tags on my application page for unexpected log-outs.
I am a newbie to actionscript, and I really don't know of a way to use the mail tags inside of the actionscript.
I've pretty much got everything working (adding, updating and deleting a record). However two things are not happening, first, a record is created, updated or deleted the grid goes blank. I have to refresh the browser to get the grid data back. Second, there is no status message after a record is added, deleted or updated. The main change I have made is that I am not using the search piece of the Real Estate app. Other than that the actionscript code is straight from the Real Estate app.
Any help would be greatly appreciated.
Ray
Thanks.
There is no fix for that yet.
http://www.forta.com/blog/index.cfm/2006/4/17/ColdFusion-And-IE-Active-Content-Changes
Cingular.services.listingService does not have a method "remove" that matches the name and parameters provided.
Here are the chunks of code:
=============================
public function submitRemove():Void {
alert(edit_cing_ID.text); <!