| By Nahuel Foronda, Laura Arguello | Article Rating: |
|
| June 16, 2005 02:00 PM EDT | Reads: |
90,168 |
First, we have an input in the Edit panel for the contact's picture called "photo" that gets its value from the cfgrid photo column.
<cfinput type="text" name="photo" label="Photo:"
bind="{contactList.selectedItem.photo}" />
Then, we have a cfformitem that will get its value from the photo field above:
<cfformitem type="html" height="100" width="100"
bind="<p><img src='{photo.text}'/></p>">
</cfformitem>
What we're trying to achieve is for the value of the cfformitem to be <p><img src='picture.jpg'/></p>, a simple html paragraph with an image inside. But the name of the picture changes for each contact so we bind the path to the photo field in the Edit panel by writing the path of the picture between braces: {photo.text}.
If you look at the source code, you'll find a slightly more complex version of the picture's cfformitem bind:
bind="<p><img src='{(photo.text == '' ? 'man.jpg' : photo.text)}' /></p>"
We're using the if-else shorthand statement again to decide whether we want to show the picture of the contact or a default if the contact photo is empty.
Now that you're getting a feeling for how binding works, we'll add the complete contact information next to the picture. In this case, the binding is rather lengthy, so we'll make a variable containing the binding string and put the variable as the value of the attribute:
<cfsavecontent variable="previewBind">
...the contents of the bind...
</cfsavecontent>
<cfformitem type="html" bind="#previewBind#"></cfformitem>
As you can see, we're using the same trick we used for the photo: if the field isn't empty, we show the value; otherwise we don't show anything. We concatenate all the fields with a "+." We also format the field label with bold and add a tab (\t) between the label and the value to align it.
{(
((fistName.text != "") ? "<b>First Name:</b>\t" + fistName.text:"") +
...plus all the other fields...
((comments.text != "") ?"<br /><b>Comments:</b>\t"+ comments.text : "")
)}
In case you're wondering how we got the picture next to the text, we used layout tags inside Preview panel (bindings explained above omitted for simplicity):
Step 6 - Styling the Form
<cfformgroup type="panel" label="Preview">
<cfformgroup type="hbox">
<cfformgroup type="hbox" width="116">
<!--- the picture --->
<cfformitem type="html" height="100" width="100">
</cfformitem>
</cfformgroup>
<cfformgroup type="hbox">
<!--- the complete contact data --->
<cfformitem type="html"></cfformitem>
</cfformgroup>
</cfformgroup>
</cfformgroup>
Now that all the elements are in place, we'll add some color and styling to the form. In flash forms, the look-and-feel of each element must be defined in the "style" attribute. Many styles defined in outer containers also apply to inner containers and controls.
As you can see in the picture of the application (see Figure 1), we applied colors to the panels. The contact list has an orange background color and the other two are blue. The complete style for the orange (Contacts) panel is:
style="themeColor:##FE7E00; headerColors:##F2CB2A, ##FFE57A;
backgroundColor:##FFE57A; panelBorderStyle:'roundCorners';"
In this style definition there are three properties applied:
themeColor: color;
Instead of using one of the halo themes (haloBlue, haloGreen, haloOrange, haloSilver) that can be applied with the skin attribute (skin="haloBlue"), we used our own custom color. The themeColor property applies the given color to all the form elements just like halo themes do. The advantage is that we can pick any color, not just one of the four standard themes.
headerColors: color1, color2;
The panel header is composed of a linear gradient of two colors that goes from top to bottom. We can change both of these colors with the headerColors property. The bigger the contrast between the two, the more pronounced the gradient will be.
backgroundColor: color;
The background color of the panel can be changed by using this property. Note however that the cfgrid isn't inheriting the background.
Published June 16, 2005 Reads 90,168
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Nahuel Foronda
Nahuel Foronda is one of the founders of Blue Instant (http://www.blueinstant.com), a web development firm specializing in Rich Internet Applications where he has been creating award-winning applications and offering training for the last five years. He also maintains a blog, called AS Fusion (http://www.asfusion.com), where he writes about Flash, ColdFusion and other web technologies.
More Stories By Laura Arguello
Laura Arguello is one of the founders of Blue Instant (http://www.blueinstant.com), a web development firm specializing in Rich Internet Applications where she has been creating award-winning applications and offering training for the last five years. She also maintains a blog, called AS Fusion (http://www.asfusion.com), where she writes about Flash, ColdFusion and other web technologies.
![]() |
RockDad 11/06/08 01:39:48 PM EST | |||
How would one modify this app to only allow employees to edit their own information assuming there is a cookie identifier already setup? |
||||
![]() |
RockDad 11/03/08 02:08:32 PM EST | |||
GREAT tutorial but how does one bind a cfselect object with the grid? Tried it and it doesn't work. Any ideas? |
||||
![]() |
Mike 01/23/08 12:19:45 PM EST | |||
where can I get the source code for this article - "Constructing an Application with Flash Forms from the Ground Up" |
||||
![]() |
wholesale ipod 10/30/07 01:18:03 AM EDT | |||
I think so! |
||||
![]() |
Garfield 07/24/05 07:47:15 PM EDT | |||
Great article by great developers. I have just starting using CF7 and thanks to many writers out there, I have developed some impressive forms. Please visit the www.asfusion.com site for more helpful info. Michael, visit http://www.cfform.com/flashforms/invoke.cfm?objectid=0204C17F-4E22-1671-... for a tutorial on binding grids to selects. Be mindful that when binding to a grid, the bind is both case and type sensitive to the DB columns. |
||||
![]() |
Michael White 07/17/05 07:39:37 PM EDT | |||
Your article was a good introduction to flash forms with multiple panels. I have a question on the Edit panel... what if some of your fields are CFSELECT dropdowns or date fields... having trouble finding working syntax for binding them to the grid. |
||||
![]() |
Andrew 07/06/05 11:40:46 PM EDT | |||
Loved the article! It has taught me alot. Maybe I am at fault here but I am not able to get any of this to save or edit in a db anyone else having same problem |
||||
![]() |
Laura Arguello 06/27/05 08:30:39 PM EDT | |||
Thank you for the comments. |
||||
![]() |
Anthony 06/25/05 05:40:50 PM EDT | |||
How do I download the source files for this article? |
||||
![]() |
Stiles 06/25/05 11:53:31 AM EDT | |||
I'm having a similar problem with getting the source code for this article. The printed version states that the source code can be downloaded at www.cfdj.com. This URL is invalid and not a site maintained by Sys-Con. Any chance the link can be updated so we can view the source code? Much appreciative. |
||||
![]() |
André 06/24/05 09:48:25 AM EDT | |||
Hi, Thank you for the article, I found it very informative, well written and helpfull. I am having difficulties with the save content section. How could one download the source code ?Could it be possible to modify the link to open on the file rather to to another site that does not seem to be CF Dev. Journal ? Again that you for sharing. |
||||
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe Flex Developer Earns $100K in New York City
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe Fiddles with its Web Apps
- Adobe & Salesforce Cut Cloud Deal
- Hosting.com Launches ColdFusion 9 in the Cloud
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe Flex Developer Earns $100K in New York City
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF

































