Our Blog

Laura

Laura

102 Comments

  1. Raymond Camden
    Thanks for this article. I had the benefit of seeing it early since I QA'd it, and there are some darn good tips in there. Some I even used on my latest DRK application.
  2. c Crimmel

    c Crimmel

    I need a web based timesheet in coldfusion.
    Do you know of any?
  3. matt
    crimmel .. i've got one i built .. . you want a copy?

    mj AT jiboo.com

    m@
  4. Joe Stramel

    Joe Stramel

    I loved this article! I am applying this to a form as we speak, but I have a question. I am pulling a date into a dateField from SQL server and am getting the long version. I have tried applying a mask, but it doesn't work when populating the form from the database. I just want MM/DD/YYYY. How do I go about that? Thanks!
  5. Holly Jones

    Holly Jones

    As usual, you guys are 3 steps ahead of the rest of us! Thanks for sharing your source!
  6. Lenny
    How can I do the same thing by querying a database instead of queryNew. I have not been able to to this. Any Ideas?
  7. mike
    How does the preview panel shrink when the check box is checked? I see no code that does this. Does it require code.
  8. Hi all,
    Thanks for your comments. :)

    Lenny,
    Querying a database is the same as queryNew. Make sure that you have the correct column names ( flash is case sensitive and sometimes are all Uppercase). You can check that with mygrid.columnNames

    Mike,
    That is a binding in the panel that is bound to the checkBox
  9. Michael White
    I also have a question about how to format date fields in the edit form but my main question is this: can a cfselect box bind with the grid and autoupdate as you select different grid items? I have been unable to make this work.
  10. Hi Michael,
    You can check this post about binding a cfselect to a grid

    http://cfform.com/flashforms/invoke.cfm?objectid=0204C17F-4E22-1671-564CF4F0B33C3D29&method=full#
  11. James
    I was wondering the same thing that Joe was:

    I loved this article! I am applying this to a form as we speak, but I have a question. I am pulling a date into a dateField from SQL server and am getting the long version. I have tried applying a mask, but it doesn't work when populating the form from the database. I just want MM/DD/YYYY. How do I go about that? Thanks!

    How would the <cfsavecontent variable="previewBind"> be written?

    Thanks!
  12. James
    Would anybody know the answer to the following variable issue within the <cfsavecontent variable="previewBind">?

    ((StartDate.text != "") ?"<br /><b>Start Date:</b>\t"+StartDate.text : "") +

    A cfinput Datefield produces a long version date like this:

    "Thu May 5 00:00:00 GMT+0900 2005"

    But I'd like this: "May 5, 2005"

    Also is there any way to get cfselect to reflect the database? In another Flash form it works fine. The following variable is definitely wrong:

    ((CourseID.text != "") ?"<br /><b>CourseID:</b>\t"+CourseID.text : "") +

    from this cfselect:
                    <cfselect name="CourseID"
    label="Course 1:"
    query="courses"
    display="Course"
    width="300"
    bind="{students.selectedItem.CourseID}"
    selected="VARIABLES.CourseID" />

    If anybody can point me to some resource where I can find the answer tha would be great.

    Thanks
  13. Byron
    James,

    I'm having the same problem trying to format a date also. I have searched far and wide with no avail. I have not found any code examples. Anybody else have any luck?

    Thanks
  14. James
    Hi Bruce,
    Well since posting I have made some progress. I was able to get the date to format to "dd/mm/yyyy" by changing it from "date/time" to "text" in the Access database. My attempts at masking the date within Access or CFINPUT didn't affect the latter format. In any case I'm happy that I could get rid of that long ("Thu May 5 00:00:00 GMT+0900 2005") date/time format.

    As for the CFSELECT issue I could solve it by adding the "?EmpID=n" to the end of the URL. In my other project "?EmpID=n" was added to the URL during page processing.

    If you find a way to further format the date let me know.

    Cheers,
    James
  15. Hi,
    This is one way to do it. It's not a binding just you manually update a textfield.
    You need to assign #onGridChange# to the onChange attribute in the cfgrid.

    These are my variables you need to update yours.
    "grid" is your cfgrid name
    "time" is a column in a grid
    "outputField" is a cfinput name

    <cfsavecontent variable="onGridChange">
    var pstDate = grid.selectedItem.time;
    var monthNames:Array = mx.formatters.DateBase.defaultMonthNamesLong;
    var dayOfWeek:Array = mx.formatters.DateBase.defaultDayNamesLong;

    var postDate = dayOfWeek[pstDate.getDay()] + ", ";
    postDate += monthNames[pstDate.getMonth()] + " ";
    postDate += pstDate.getDate() + ", ";
    postDate += pstDate.getFullYear() + " ";
    var hours = pstDate.getUTCHours()+10;
    postDate += (hours % 12)+":";
    postDate += (pstDate.getMinutes() < 10)? "0"+ pstDate.getMinutes() + " ": pstDate.getMinutes() + " ";
    postDate += (hours<12) ? "AM" : "PM";

    outputField.text = postDate;
    </cfsavecontent>

    <cfgrid name= "grid" query="myquery" onchange="#onGridChange#">
    <cfgridcolumn name="time" header="date">
    </cfgrid>
    <cfinput type="text" name="date" label="Date" bind="{grid.selectedItem.time}"/>
  16. James
    Nahuel,
    Thanks for the time and effort to offer a possible solution to my quandary. I'm not sure if I can use this since I already am using an onChange "getUrl" event with the cfgrid. Is it possible to use, i.e. combine, two onChange events?

    Thanks again :)
  17. Byron Raines

    Byron Raines

    Nahuel,

    Thanks for you code. When I try to implement it (select a row in my grid and there is a value for date), I get an "undefined" in the input box (also no output is displayed in the Details panel. However, when I put in a date, the date is correctly displayed in the <cfinput> and also in the #binding# of the Details panel.

    Can the cfinput name be the same as the grid column name?

    Thanks

    Byron
  18. Update: you can add the mask attribute to the cfgridcolumn - mask="mm/dd/yyyy" and everything displays correctly
  19. KomputerMan
    Can you add a CFSELECT to your edit window and bind it to a selectedItem value from the left hand window so the correct value shows as selected in the drop down list???
  20. Michael White
    Ray Camden has a nice routine to synchronize cfselects to a datagrid:http://ray.camdenfamily.com/index.cfm/2005/8/6/Ask-a-Jedi-Enhancing-the-Flash-Form-Grid
  21. Michael White
    Let's face it, this article was a groundbreaker... it really gave me confidence to use flash forms and now I'm using the lessons here in my current project. Here is what I need help with now... simulating a subform. I have a flash form that has a cfgrid on the left (that shows something like orders), edit panel on the right (that shows all of the Order Fields) and I want to put another cfgrid below the two of them that shows the line items of each order (bound by the orderID) I tried a direct binding on the two orderID but I guess that's not supported on a gridcolumn so then I thought I would just supply the orderID to the call to the component that supplies the query to populate the line items but how would I keep it synchronized as users went from one order to the next? I thought maybe a single line of actionscript in my cfsavecontent "onChange" routine might do it but oh yeah... I don't know any actionscript... Help!

    p.s. Ray Camden supplied the onChange code to synchronize my cfselects on the edit form to the order cfgrid
  22. Michael White
    oops, the updated ray camden article is here: http://ray.camdenfamily.com/index.cfm/2005/8/7/Ask-a-Jedi-Enhancing-the-Flash-Form-Grid-2
  23. Michael White
    on the preview panel, suppose you wanted to bind some data fields from a query instead of binding to a grid. say the preview panel contained info about the user profile which changes for each user but not with each order.
  24. Michael White
    here's what I've got so far: if I try to use cfformitem like this sample line

    <cfformitem type="html" bind="<font face='Tahoma,Georgia,Verdana,_sans'><textformat leading='8' tabstops='[86]'><b>First Name:</b>/t #qryUserInfo.FirstName#</textformat></font>">

    Everything works fine except the Tab. I can't figure the syntax to put the whole thing in cfsavecontent either which would be preferable.

    I don't suppose you have any books coming out on Flash Forms in Coldfusion anytime soon...
  25. michael White

    michael White

    Ok, here's another dumb question (but an easy one, I hope) I want to add the values of three text controls on a flash form (apples, oranges, pears) which are all decimal numbers. If I use this bind statement: bind="{apples.text*oranges.text*pears.text}" they multiply fine but if I use this statement: bind="{apples.text+oranges.text+pears.text}" all it does is concatenate the values as if they were text.
  26. michael White

    michael White

    Thanks for the quick response, that worked!. it doesn't calculate until all three are populated but it works. I get a "NaN" in the total box. Maybe I need an "if" in there somewhere?
  27. michael White

    michael White

    I hope you're not tired of me posting to the same article every day... but here's another one: I saw above you helped some people with Date stuff and I have a simple question (for you), how do you do simple date/time calculations like adding and subtracting times (EndTime - StartTime) and number of days between two dates (EndDate - StartDate) in a flash form. I can live with either a bind statement or an onChange event. This is simple, right? There's so little information on Flash Forms in coldfusion, you're my only hope Obi-Wan
  28. Hi Michael,
    If you want more info about the Date object I recommend that you take a look at this link:
    http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001295.html
  29. Michael White
    Nahuel, thank you for the response... believe me when I say I have poured over those livedocs and and in flex as well but they ALL use the "new" keyword in ALL of their examples and that is one of the restricted keywords in CFMX7 flash forms. so my main problem is how to get around that limitation... what would be the syntax for a date calculation... of any kind?

    I am about to give up on this problem and simply forgo the magic of seeing the date/time calculation appear for the end user, make the fields invisible and simply calculate them in the "process.cfm" page and hand it off to the cfc to update the database. I figure that's better programming anyway... MVC and all that.
  30. Michael,
    If your dates are coming from the grid, they are already instantiated you don't need to use new for that. Actually, most of the time when you have a date in your database and you send that to your cfform it gets transformed into a date object. If this is not your case, tell me what you have.
  31. Michael White
    I think my problem is one of syntax. If I were to do a quick budget estimator for a project I might put a flash form together with fields like StartDate, EndDate, BillRate and Budget. Budget is a calculation assuming 52 weeks in a year and 40 hours in a week. in Coldfusion, this calculation might look like this: <cfset EstBudget = (((#Week(form.EndDate)# + (52 * (#Year(form.EndDate)# - #Year(form.StartDate)#))) - #Week(form.StartDate)#) * 40) * #form.BillRate#>
    In a SQL query it might look like this:
    SELECT StartDate, EndDate, BillRate, (DATEPART(ww, EndDate) + 52 * (DATEPART(yy, EndDate) - DATEPART(yy, StartDate)) - DATEPART(ww,
    StartDate)) * 40 * BillRate AS EstBudget
    FROM dbo.Projects
    So my question is, how can I make something like that work in a flash form so that it calculates the budget as you update each field?
  32. Michael White
    the other syntax problem I have is this: if I want to display a hyperlink on a coldfusion flash form and have it send a url like <a href="budgetcalc.htm?pid=#ProjectID#>Get Budget</a>? I can get it to display a hardcoded url and link to a page but not one bound to a field from the cfgrid. Either the url doesn't display at all or i get a syntax error (expecting ')' or "+ operator requires Operand"). It's something I know is dead-dumb simple to do but the syntax...
  33. Patty
    I am trying to create a preview area made up of a mix of HTML and cfform variables in a binding string. This is similar to the ASFusion article in ColdFusion Journal. I conceptually understand how to do this, but I think that the syntax is getting me. What I'm trying to show is a table using a backround image with styled text over the image. I'm getting the text, but it is not styled, the image does not appear and my link does not show as a link.

    Here's my code:

    <cfsavecontent variable="featureBind">
    {(
    ("<table><tr><td width='330' height='257' align='left' valign='middle' nowrap'") +
    ("background='" + photo_url.text + "'>") +
    ("<table width='330'><tr><td align='left'><br /><p class='featureHd'>") +
    ("<font color='" + headline_color.text + "'>" + headline_text.text + "</font> </p>") +
    ("<font color='" + body_text_color.text + "'>" + body_text.text + "</font></p><br />") +
    ("<a href='" + link_url.text + "' CLASS='featureLink_light'>") +
    ("<font color='" + link_color.text + "'>" + link_text.text + "</font></a></td>") +
    ("</tr></table></td></tr></table>")
    )}
    </cfsavecontent>

    ...

    <cfformgroup type="panel" label="Preview" >
    <cfformitem type="html" height="257" width="330" bind="#featureBind#"></cfformitem>
    </cfformgroup>

    Can anyone help?

    Thanks,
    Patty
  34. Laura
    Patty,
    It is not possible to add class definitions nor tables to the cfform html.
    The only supported tags are:
    http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001040.html

    In plain flash, you can use css classes, but not in cfform.
  35. Patty Toretti

    Patty Toretti

    Thanks for the quick answer, Laura.

    OK, I can format the text with <font> tags. But how do I get the image as a backround? What I'm wanting to simluate is a "feature" section like the area with the text over the woman and kid in the site http://egov.oregon.gov/DCBS/

    (Yes, I work for the State of Oregon)

    I can do this in Cold Fusion using CF, HTML and CSS. I'm trying to learn the new CFFORM Flash tags by trying to do the Admin side of setting up a Feature in a CFFORM as a test case.

    Would I need to create a "still" Flash file to show this?

    Thanks again, Patty
  36. Patty,
    You can put your image with css check backgroundSize in the docs

    http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=part_cfm.htm
  37. Michael White
    Ok, I found the solution to my Two datagrid problem in the macromedia forums.
    http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=22&threadid=1014611&highlight_key=y
    I guess it's old news.
  38. Chikowski

    Chikowski

    Is there a way to use a cfselect instead of the cfgrid on the left?
  39. Laura
    Chikowski,
    The regular cfselect lacks the additional data/columns required to bind other fields as it is done in the article example. If you want a list (not a dropdown) you can omit the headers in the cfgrid and it will look almost as a select.
    If you really need a select, the only way would be to load it via remoting as it is described in http://www.asfusion.com/blog/entry/how-to-populate-a-cfselect-with-flash
    in which case, you will have all the other columns available and you could bind them by mySelect.selectedItem.myColumn
  40. I love the flash form example that you discussed. Excellent!! With everything that is going on (separate grids,groups, etc), can anyone give me any suggestions or redirect me to resources on how to write an action page for processing the update/delete/insert? Thank you!!! (A novice trying to find my way around in CF!)
  41. Connie Decinko
    I also am having issues trying to add additional information for each person. I want to show a list of interests for each person. That list is in another table, a many-to-many relationship. I currently have two queries coming back via a struct. The grid is able to find the query in the struct. But a repeater panel barfs if you try and specify a query as part of a struct. At this point, I am about to stuff the results of the second query into another column of the first query as a comma delimited list. Sloppy, but I don't see any other way.
  42. Felipe Serrano
    HI there all...

    Instead of using the "contacts.cfc" component, I set it up to work with MySQL data base (Im a begginer) can any body help me to set up the cfquey scripts so I can edit and add information to the database? from the cf-application!

    PLEASE!

    Thanks in advance
  43. Michele

    Michele

    Laura & Nahuel -

    Is it possible to enter a field prompt in a cfinput field? I have a phone field and I'm using a mask (999)999-9999. I want to put the prompt "enter area code first" in the field, but of course I don't want to submit this if the user does not enter a phone. Thanks for all the great examples. I have learned so much from your site!
  44. Steve
    Did anyone find a solution to NaN being displayed in michael White's question from 8/15/05 5:06 PM?

    Thanks

    Steve
  45. Kiley
    Suppose you have employees with different status'. If you click the employee from the left and the employee is the correct status, can you show a specific drop down field?

    For example, if the employee is 'Management', have a drop down of 'Departments' so you can re-assign the employee to a different department.

    Is that possible?
  46. Vale
    Quick question... anyone know why simply removing the <cftextarea> tag (getting rid of the Comments: field) will cause the resulting flash applet not to load? I don't get an error on the client or server.. just doesn't "Initialize" the flash applet! Driving me crazy! I get the same results when fiddling with removing/adding <cfinput> tags for various form fields. Anyone have a clue?
  47. Doug
    Really liked the ...ground up article. Was trying to modify and combine it with a CFGrid article from sys-con. The problem is I want information that is showing in the "right" panel that is bound to the "left" to be a link. I tried to copy the code you suggested for binding a picture but was not successful. I get the following error:

    Invalid token '/' found on line 39 at column 94.
    The CFML compiler was processing:

    a cfformitem tag beginning on line 39, column 12.


    The error occurred in C:\Inetpub\wwwroot\Volleyball\family\accordion_eastCoast.cfm: line 39

    37 :                   <cfinput type="text" name="reason" label="Reason" bind="{JaysonList.selectedItem.reason}"/>
    38 :                   <!--- <a href="#gifts3.store#">Store</a> --->
    39 :     <cfformitem type="html" bind="<a href='{JaysonList.selectedItem.store}'>Store</a>"</cfformitem>

    My website link shows I can get the info into a label, now I want to make it a link.

    Thanks I have really enjoyed your examples.
  48. Laura
    Vale,
    Your life will be easier of you turn debugging on.
    The reason why the form does not compile if you remove controls is that the preview panel expects to get data from them. You need to remove the parts where the removed controls are referenced.

    Doug,
    Your cfformitem is not properly closed:
    <cfformitem type="html" bind="<a href='{JaysonList.selectedItem.store}'>Store</a>"</cfformitem>

    It should be
    <cfformitem type="html" bind="<a href='{JaysonList.selectedItem.store}'>Store</a>"></cfformitem>
  49. Kiley
    Has anyone been able to combine a file upload with this example? I've been working on it for some time and can't get it to work.

    Thank you,

    Kiley
  50. xavy
    Is it possible to bind the same input field to two different grids conditionally? I have two grids - if you click on one it is for adding a new product and if you click on the other it is for editing an existing product. Both the grids is connected to a set of text boxes and date fields in an add/edit scenario.
  51. Laura
    xavy,
    yes, you can. Look at this article, it may give you some ideas on how to do it:
    http://www.asfusion.com/blog/entry/coldfusion-flash-forms-macromedia-2
  52. xavy
    Thanks Laura
    I used both the grids in the bind to make this work:
    "{(grid1.selectedItem!=undefined)?grid1.selectedItem.description:''}
    {(grid2.selectedItem!=undefined)?grid2.selectedItem.description:''}"

    Any way to get debug info displayed in a flash form - I just get a white screen when there is an error in the action script and the flash form does not load - if there is some kind of error message as to what is wrong...

    Thanks,
    xavy
  53. Laura
    xavy,
    You need to enable "Flash Form Compile Errors and Messages" in the CF administrator
    Debugging & Logging settings page
  54. Joseph

    Joseph

    Laura - Thank you very much for so many excellent tools. I have learned a lot about coldfusion and flash forms just through your site and examples alone.

    While using this, I was working on modifying the code into an employee table where you can only modify your own contact information, but you can see everyone's.

    The first step was to change the height of the editing window as such:

    height="{(editShow.selected & (contactList.selectedItem.EmployeeID == #SESSION.EMPID#) ) ? 332 : 0}"

    This worked just as I would expect - of course, that leaves the borders messing up the bottom, so the next step would be to change the visible tag to match the above, except instead of '332' and '0', it would be 'yes' and 'no'.

    It didn't work. The flash form wouldn't even load.

    Even simply changing visible to

    visible="{(editShow.selected)?'yes':'no'}"

    or

    visible="{(editShow.selected == 'yes')?'yes':'no'}"

    or any number of other variations on the ?: structure resulted in the flash form refusing to load up.

    Are iff constructs somehow not allowed in the visible tag? Or am I just doing something wrong?
  55. Joseph,
    Try to use true or false because in actionScript yes and no doesn't work

    visible="{(editShow.selected)? true:false}"

    also this can work too
    visible="{(editShow.selected)}"
  56. Geoffrey Barth

    Geoffrey Barth

    I only changed the contacts page to a real query and match all the field names and the page will load my people on the left but will not display any info on right, how are the two panes connected?
  57. Laura
    Geoffrey,
    The preview panel's data is bound to the columns of the datagrid. If you change the column names, you need to make adjustments to all the bound elements (including the form inputs). I would recommend you to read the article, as that is explained there.

    Hope that helps
  58. Timothy Pipe

    Timothy Pipe

    Is there a way to compare 2 dates in flash and show which date is more recent?
  59. Joseph

    Nahuel - that did help, thank you.

    Timothy -

    I'm sure there is, but I can't remember / find how to do it right now. If all else fails, you can always use components and remoting to create your own function.
  60. Thomary

    Thomary

    I'm having a problem with a delete button. If I have it as a type="submit" the query to delete works fine.

    The problem: I have a cfselect that is required. The historical data in mysql database did not require that field and therefore the field is empty more often than not. When I try to delete (submit) and that required field is empty, it gives an error and shows the “Red” required field.

    I’ve tried something with:
    mx.validators.Validator.disable( this, "myFormName.myFieldName");
    but this did not work. Not sure if I’m using it properly. I thought I needed to change the button from a submit to button but this did nothing.

    I thought I could set this field to “abc” onClick of the Delete button, then run the delete query but this did not work either.

    Any suggestions would be greatly appreciated.
  61. Daniel
    I have this up and working using a CFLDAP query to return our Active Directory contacts. I added code to select the first row via cfformItem type "script". I also have a hidden form field that is bound to the grid's selectedIndex. My action page updates Active Directory and then returns back to the form. I'd like the user to be returned to where they left off. I can use the hidden field to set a variable but how do I pass this variable back to the script?
  62. Daniel
    Oh yes, before I forget. I also have several cfselects that use the grid's onchange event to bind them to the grid. Problem is, unless you actually click a row, the onChange doesn't fire leaving the selects blank. Does anyone know of a way to programatically fire the onChange event?

    Thanks so much for your site. I've learned so much from reading your articles.
  63. Joseph
    For passing the variable back to the script, the best way I can think of going about that is using a link with some URL data, and passing that into the script.

    Either that, or use flash remoting to create some functions that'll run without having to refresh the page, and thus, losing the variables.

    As for the 'programatically fire the onChange event', I think this might be what you're looking for:

    http://www.asfusion.com/blog/entry/knowing-when-the-cfform-data-arrives

  64. Daniel
    Thanks Joseph,
    I can pass the variable back using URL data, or a session variable but getting back into the script is the problem. According to Laura "Any ActionScript code we add to a cfform becomes part of the generated file. If anything in the generated file changes, then the form must be recompiled. Having a variable that changes in every request will make the form recompile each time, making the form slow to load, showing a blank screen (not the preloader)." She's right, my forms recompiles :( I am already using the code you referenced to select the first record. The bit I want to manipulate is: contactList.selectedIndex = 0;
  65. Joseph
    Then what you'll probably need to do is to set up some flash remoting functions, such as used here:

    http://www.asfusion.com/blog/entry/asf-file-explorer-released

    This is a bit complex, but it *may* be what you're looking for. At least, from your description, that's what I'd do.
  66. Laura
    Daniel,
    If you need a variable, say a session variable, you can put it in a hidden field:
    <cfinput type="hidden" name="myvar" value="#someOtherVar#">
    and then reference it as:
    myFormName.myvar
    For example:
    contactList.selectedIndex = myFormName.myvar;

    (not the above code makes any sense, but you get the idea)
  67. Daniel
    Laura, Joseph
    Thanks for the feedback. I did indeed get the idea Laura and am happily passing variables to & fro, thank you very kindly. As for the other matter: I am using the onChange event for the grid to bind data to my selects (obliges to Ray Camden). Problem is, when the form loads a grid row is selected (thanks to that variable I'm passing around) but my selects have the first item in their list (default behavior) because onChange has not fired. Any thoughts?
  68. Traci
    Hello All,
    Has anyone got some advice for a new person trying to learn how to implement this? I have a NaN displayed in the total field, and can't seem to get past that. I see two other posts here asking about this, but no one seems to have answered. Any assistance would be greatly appreciated.

  69. The NaN tends to display if some of the fields are empty or have letters in them. Make sure to pre-fill all the fields with 0's.
  70. Traci
    Hello All,
    Has anyone got some advice for a new person trying to learn how to implement this? I have a NaN displayed in the total field, and can't seem to get past that. I see two other posts here asking about this, but no one seems to have answered. Any assistance would be greatly appreciated.

  71. Traci
    Oops... sorry, accidentally reposted my old comments...

    Joseph:
    I have configured my query to remove nulls, and adjusted the grid to only show populated rows... it still says NaN. Do you have any other suggestions?
  72. Traci
    Oops... sorry, accidentally reposted my old comments...

    Joseph:
    I have configured my query to remove nulls, and adjusted the grid to only show populated rows... it still says NaN. Do you have any other suggestions?
  73. stephen

    stephen

    I had the best luck with remoting out to a cfc file and doing my calcuations in coldfusion, returning a coma separated string of my needed results and the spliting that into an array for the rest of my remoting.

    LOL
    Stephen
  74. xerrano
    Ok, I hope some one can show me the way...
    What I like to do with this great flash-form example is this:

    How Can I have multiple CFSELECTs and INPUT Text Fields, where the user will select and enter the search criteria, and when the user submit his selection the CFGRID will be populated by this query. I think everything else will work as now; once the cfgrid gets populated and the user click on a row the info will show just like now.


    Any ideas?

    Thanks a lot


    Felipe Serrano
  75. stephen

    stephen

    <!--- this is an onclick remote actionscript--->
    <cfoutput>
    var connection:mx.remoting.Connection =
    mx.remoting.NetServices.createGatewayConnection
    ("http://#cgi.HTTP_HOST#/flashservices/gateway/");
    var myService:mx.remoting.NetServiceProxy;
    </cfoutput>
    var var1:String ="";
    var var2:Number =0;
    var var3="";
    var var4="";
    var responseHandler = {};
    responseHandler.onResult = function( results: Object ):Void {
    if (results.length > 0) {
    _root.yourgrid.dataProvider=results;
    alert("Update Complete");
    }
    }

    responseHandler.onStatus = function( stat: Object ):Void {
    alert("Error updateing:" + stat.description);
    }
    myService = connection.getService("remote_flash_cfc_file_with_no_extention", responseHandler );
    myService.getUpdate(var1,var2,var3,var4);



    <!---this is the remote cfc --->
    <cffunction name="getUpdate" output="false" description="Returns a query with names (var1,var2,var3,var4)"
                   access="remote" returntype="query">

    <cfargument name="var1" required="true" type="string" />
        <cfargument name="var2" required="true" type="numeric" />
    <cfargument name="var3" required="true" type="string" />
    <cfargument name="var4" required="true" type="string" />

    <!--- if you want to work with any of your envir vars--->
    <CFINCLUDE TEMPLATE="yourcfapplication.cfm">


    <CFQUERY NAME="queryname" DataSource="databasename">
    select * from database WHERE fieldname='#var1#'
    ORDER BY fieldname DESC
    </cfquery>

    <!--- make sure this matches the name of the query used in the grid on your form you are updating--->
    <cfreturn queryname />


    </cffunction>
  76. George
    I cant figure out how the website like Preview part works. I have a grid and when I make a selection in the grid an image shows up on the right of the grid. I also have text that goes with it, it looks good and functions good. I want one of the parts of the text to show the web address and allow for clicking on the link and open a blank page showing the linked site. I have the data coming into the form that has the urls in a field. I call this in with a standard query in the cfm page. I just cant figure out how to make it so I can press on the link?

    Thanks
  77. Laura
    George,
    I am not sure I understand your question. The example shows how to add a link to the preview panel. I know it is a little cryptic, but it is really a simple <a> tag.
  78. Don
    I want to add another button control to go to a different URL or template. What is the simplest method? Do I need to use javascript?

    Thanks
  79. Laura
    Don,
    You don't need JavaScript. Use onclick="getURL('yourpage.cfm')"
    See http://livedocs.macromedia.com/flash/8/main/00001730.html
  80. Don
    The "getURL" worked great.
    I'm very new to this, so sorry for the basic questions...
    What is the syntax to pass the selected record parameters to a different template?

    Thanks,
    Don
  81. Laura
    Don,
    You would do something like:
    onclick="getURL('yourpage.cfm?id=' + myGrid.selectedItem.someColumn)"
  82. Tara
    When my flash form is opened, it takes awhile to load. Is there a way to get the "initializing" bar to appear at the top of the screen rather than the middle of the screen? My form is so long that the user cannot see the "initializing" bar and it appears that nothing is really happening.
  83. stephen
    Good luck, have not figured it out with several stabs at research and dinking around. Whatever you put up will be blanked and in my case the the particular form is huge and there is about 5 seconds of white space before the initializing comes up. Preload seems to not have options in flash forms. The way I got around all of this was to add a javascript message "Please wait while page loads" with my head load and then using the "onload=" flash option to remove the message. Works pretty well with the form in a layer and the message above the layer. The "inializing" message and my javascript generated text remove at almost the same time so it should work for you. You will not be able to center though because the loading form blanks out a white space where your form is loading so the message MUST be above this to show.

    LOL,
    Stephen
  84. Jenny
    Hi you all,

    I'm having a problem to pass variables using getURL. Let me try to descripe my situation, here it is:
    I have this page (page1) the user can select different parameters (from drop down and radio buttons) to get a report according what the user select. The next page (page2) will display the data in cfgrid. I don't have any problems to pass the parameters using getURL to page2. Here is the code: onclick="getURL('page2.cfm?name='+preSelectName.value+'&status='+status.selectedData+'&sdate='+preSelectDate.selectedItem.data+'&loc='+preSelectLoc.selectedItem.data+'®='+regStatus.selectedData)". I have a print image icon on page2 which the user can click to get a Flash PDF file(page3) to print out the report. Here is the problem: I couldn't pass those same variables the user selected from the page2 to page3 using getURL. This is the code:
    <cfinput type="image" name="print" align="right" src="print.gif" height="25" width="24" onclick="getURL('page3.cfm?name='+#URl.name#+'&status='+#URl.status#+'&sdate='+#URl.sdate#+'&loc='+#URl.loc#+'®='+#URL.reg#)" border="0">

    I've been struggling with it for three days. Any help or hint will be great appreciated!!!

    Thanks!

    Jenny
  85. Sam
    I need this application functional with Database. Did anyone here managed to get this app working with a Database? Really need it.

    Maybe is there any guide that I could use to get it working with Database like being able to get the insert,update and delete records functional.
  86. sam
    Is it possible to totally clear the preview panel when the editShow button is selected and how?
  87. sam
    Laura,
    Can you please help me completing this application , so that it would be able to interact with Acccess database and do a simple maintenance like add,delete and update or maybe there will be a print button to print the contact details in the preview panel.

    I 'm new in Coldfusion and still learning very hard but I love and wants to use this address book personally.

    I would buy anything you wish on your Amazon wist list.

    Please help. please...
  88. Laura
    Jenny,
    The problem that you have is the following:
    In the first page, you do it correctly, you are using getURL(), which is an ActionScript function and constructing the url parameter using ActionScript variables. getURL('page2.cfm?name='+preSelectName.value);

    But, in the second page, you mix ActionScript with CF variables, and that does not work, at least not the way you are doing it. If you would see the generated code, you would see syntax errors, as what you are writing would translate to something like:
    getURL('page2.cfm?name='+ myName); where myName is not a variable, the actual name (a string) you want to pass.
    In order to avoid recompiling of the form, I would store all the url variables in multiple or one hidden field and use the same syntax you use in the first page, but using myFormName.myHiddenFieldName as variables.

    Sam,
    This application uses form post, so any tutorial that shows you how to insert/delete/update data coming from a form should help you.
  89. Sam
    Thanks Laura,

    I'm aware of that, but I would like to have it in Flash remoting with CFC. I have sucessfully implemented the search function following the Real Estate example where I just used this UI instead of the actual UI in Real Estate.

    But unable to do so for the records maintenance following the Real Estate example. I was confused as in that example the mls_id is not a autonumber whereas mine is access db is using an autonumber.

    Maybe you could have another tutorial similar to the Real Estate where the mls_id is autonumber which is not editable.

    Thanks
  90. Alex
    Hi, help me please!!!

    I'm developing an application like the Contacts application that when you click in the grid, the details of the record apears in other panel section of the cfform.

    Well I already do that but I need to query other table when click the grid it display the values in the same panel that I tell you above. how can I do that?


    This is my application.
    http://www.comimsa.com.mx/temp/consulta.cfm


    <cfscript>
       contactsQuery = createObject("component","components.proveedor").getProveedor();   
    </cfscript>

    <cfsavecontent variable="previewBind">
       {"<textformat leading='8' color='red' tabstops='[86]'><font face='arial'>"}
       {(
           "<b>Nombre Comercial: </b>\t" + contactList.selectedItem.nombrecomercial+
           "<br/><b>Tipo de persona: </b>" + contactList.selectedItem.tipopersona+
           "<br/><b>RFC: </b>"+ contactList.selectedItem.rfc +
           "<b> CURP: </b>"+ contactList.selectedItem.curp +
           "<br /><b>Nombre o Razon Social: </b>\t"+ contactList.selectedItem.razonsocial +
            "<br /><b>Calle y numero: </b>"+ contactList.selectedItem.calle +
           "<br /><b>Colonia: </b>"+ contactList.selectedItem.colonia + " <b>CP: </b>"+ contactList.selectedItem.codigopostal +
           "<br /><b>Ciudad: </b>"+ contactList.selectedItem.ciudad+"<b> Estado: </b>"+ contactList.selectedItem.estado
       )}{"</font></textformat>"}
    </cfsavecontent>
    <cfsavecontent variable="previewBind4">
       {"<textformat><font face='arial'>"}
       {(
           "<br /><b>CLASIFICACION DE PROVEEDORES (Sector y Giro declarado en el SAT)</b>"+
           "<br /><b>Sector: </b>"+ contactList.selectedItem.sector+
           "<br /><b>Subsector: </b>"+ contactList.selectedItem.subsector+
           "<br /><b>Rama: </b>"+ contactList.selectedItem.rama+
           "<br /><b>Subrama: </b>"+ contactList.selectedItem.subrama   
       )}{"</font></textformat>"}
    </cfsavecontent>

    <cfform name="addressBook" format="flash" width="100%" height="500">
       <cfformitem type="script">
          function applyFilter( term:String, grid:mx.controls.DataGrid, columns:Array ):Void {
          
             var filterTerm:String = term.toString().toLowerCase();
          
             if(filterTerm.length > 0) {
                if(_global.unfilteredData[grid.id] == undefined){
                   if (_global.unfilteredData == undefined){
                      _global.unfilteredData = {};
                   }
                   _global.unfilteredData[grid.id] = grid.dataProvider.slice(0);
                }
                
                var filteredData:Array = [];
          
                for(var i = 0; i< _global.unfilteredData[grid.id].length; i++) {
                   var item:Object = _global.unfilteredData[grid.id][i];
                   var added:Boolean = false;
                   
                   for(var j = 0; j< columns.length; j++){
                       if(!added){
                         var value:String = item[columns[j]].toString().toLowerCase();
                         if(value.indexOf(filterTerm) != -1)   {
                            filteredData.push(item);
                            added = true;
                         }
                      }
                      else {
                         break;
                      }
                   }
                }
          
             grid.dataProvider = filteredData;
          
             }
             else {
                if(_global.unfilteredData[grid.id] != undefined) grid.dataProvider = _global.unfilteredData[grid.id];
             }
          }
       </cfformitem>


       <cfformgroup type="hbox" height="480">
        <cfformgroup type="panel" width="450" label="Busqueda de Proveedores"><!--- panel to contain the contact list --->
          <cfformgroup type="horizontal">
             <cfinput type="text" name="term" onchange="applyFilter(term.text,contactList,['nombrecomercial','ciudad','estado'])" label="Filtrado por:">
             <cfgrid name="contactList" query="contactsQuery" rowheaders="false" height="400">
                <cfgridcolumn name="nombrecomercial" header="Nombre Comercial" width="200"/>
                <cfgridcolumn name="ciudad" header="Ciudad" width="100"/>
                <cfgridcolumn name="estado" header="Estado" width="100"/>
             </cfgrid>         
          </cfformgroup>
        </cfformgroup>
          <cfformgroup type="vbox">
             <cfformgroup type="panel" label="Detalles"><!--- panel to contain the contact preview --->
                <cfformgroup type="hbox" style="backgroundColor:##E9EAFF; marginLeft:10; marginTop:10">
                      <cfformitem type="html" bind="#previewBind#"></cfformitem>
                      <!-------><cfformitem type="html" bind="#previewBind4#"></cfformitem>
                </cfformgroup>
             </cfformgroup>
             <cfformgroup type="panel" label="Edit"><!--- panel to contain the edit form --->
             </cfformgroup>
          </cfformgroup>
       </cfformgroup>
    </cfform>
  91. Calvert
    I have a query that will return over 1,000 records to my contacts grid. This of course is not ideal. Does anyone know how to implement paging , showing next, previous, and/or 1 of 50 of the available records?
  92. Joseph
    Well, Calvert, one possibility would be for your query and the code surrounding your query to also count to find out which page your results are supposed to be on, adding one more field to your query. Then you can sort off of page number.
  93. Tad
    Spent a lot of time trying to figure out binding a datefield in a <cfsavecontent> variable so that the formatting would be displayed as 'MM/DD/YYYY'. We are an Oracle shop where I work. I found that the easiest way to accomplish this is in the query within the CFC. When selecting the data from the query just use "to_char(datefield_name, 'MM/DD/YYYY') aliasname". Then in the <cfgridcolumn> for that particular datefield you would reference the aliasname (example: name="CREATEDATE"). Remember to use capital letters for Oracle as column names are rendered as all caps. The <cfsavecontent> variable would also reference the alias as well (ex: "<br/><b>Create Date: </b>&nbsp;&nbsp;\t" + gridName.selectedItem.CREATEDATE) and also the <cfinput> on your edit form. When the data is displayed it should already be formatted as 'MM/DD/YYYY'. Hope this helps a few more newbies out!
  94. Peter Tanswell
    I have been looking at the ColdFusion Flash Forms CFDJ article and downloaded the files and have been looking at how the application has been built.

    The only thing I cant see at this stage is how validation of fields in the edit form has been done. Especially the Zipcode.

    If I have a zzip code of less than 5 chars the field is highlighted.

    Can you advise where the validation of this field is done.

    Many thanks

    Peter
  95. Jim
    Ok heres a twist on this. The cfgride has a column that has the file name in it. I want to create a hypderlink/download button for that is dynamic. That is as you select a line in the grid the value of the download hyperlink changes. When the user clicks on the button/link the save as dialog would appear.

    Thanks

    Jim
  96. Adrian
    I am new to flash forms with Cold Fusion 8 and cannot get a cfselect to work with a cfgrid.

    When you select an item in the select it should load the grid with the correct data.

    I'd then like to be able to check the data I want in the grid and save it.

    This image will show what I am trying to do.

    http://i21.tinypic.com/2d6w1hd.jpg

    Can anyone help?

    Thanks
  97. Scott
    I'm relatively new to flash forms in CF and can't figure out why my fields won't line up like in the example. I've done a code comparison and can't seem to track down the issue. The issue is that the comments field doesn't align on either the left or right side with the fields above it as it appears in the example. Here is my code:

    <cfform action="servicerequest.cfm" name="servicerequest" format="flash" style="themeColor:##2B52FF;" width="100%">
       <cfformgroup type="hbox" height="275">
       <cfformgroup type="vbox" style="verticalGap:4">
    <cfformgroup type="panel" height="275" label="Oppliger Service Request"
    style="panelBorderStyle:'roundCorners'; backgroundColor:##E9EAFF; headerColors:##CED7FF, ##D9E0FF;">
    <cfformgroup type="hbox">
    <cfformgroup type="hbox">
    <cfinput type="text" name="firstName" label="Your First Name:" required="true" validate="noblanks" message="First Name is required" />
    <cfinput type="text" name="lastName" label="Your Last Name:" required="true" validate="noblanks" message="Last Name is required"/>
    <cfinput type="text" name="title" label="Your Title:" required="false" />
    <cfinput type="text" name="phone" label="Your Phone:" required="true" message="Telephone Number is required" mask="999-999-9999" />
    <cfinput type="text" name="email" label="Your Email:" required="true" validate="email" message="A valid email address is required" />
    </cfformgroup>
    <cfformgroup type="hbox">
    <cfinput type="text" name="company" label="Company:" required="true" validate="noblanks" message="Company Name is required" />
    <cfinput type="text" name="address" label="Address:" required="true" validate="noblanks" message="Address is required" />
    <cfinput type="text" name="city" label="City:" required="true" validate="noblanks" message="City is required" />
    <cfinput type="text" name="state" label="State:" required="true" validate="noblanks" message="State is required" />
    <cfinput type="text" name="zip" label="Zip:" validate="zipcode" required="true" message="Zip Code is required" />
    </cfformgroup>
    </cfformgroup>
    <cfformgroup type="vertical">
    <cftextarea name="comments" height="45" width="200" label="Comments:"></cftextarea>
    <cfformgroup type="horizontal" style="horizontalAlign:'right'">
    <cfinput type="submit" name="deleteContact" value="Reset" style="borderThickness:1;" />
    <cfinput type="submit" name="submit" value="Submit" style=" borderThickness:1;"/>
    </cfformgroup>
    </cfformgroup>
    </cfformgroup>
    </cfformgroup>
       </cfformgroup>
    </cfform>
  98. sabiha Chowdhury

    sabiha Chowdhury

    Hi...I am new in using Cfgrid...I am trying to (already did) simple this type of example (dealing with image)..But I also want to edit the table in same time..means I want to populate data from query and editing the table..and here one of the column in image which path also coming from database information..don't need to edit the image..need edit the text for each row..Please help any one...need to say..I did already editable data table but image is not displaying...another one image showing but then text (table data) can't edit...any one please help
  99. Joe
    In the previewBind, how would you go about displaying all the selections for cfselect that has multiple selections?
  100. Creid Norn

    Creid Norn

    I have a little problem. I can't seem to Add/Edit anything.
    And when I press the Add Contact button, it shows "undefined" in all input boxes.

    Thanks in advance. ^_^

    -sorry, I'm still a newbie with CF- ^_^