|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV SYS-CON.TV WEBCASTS |
TOP COLDFUSION LINKS Flash Forms Constructing an Application with Flash Forms from the Ground Up
You can do much more with them than with simple forms
Jun. 16, 2005 02:00 PM
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:" Then, we have a cfformitem that will get its value from the photo field above:
<cfformitem type="html" height="100" width="100" 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: The content of the previewBind variable is: 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. 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 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; In this style definition there are three properties applied:
themeColor: color;
headerColors: color1, color2;
backgroundColor: color; YOUR FEEDBACK
CFDJ LATEST STORIES . . .
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||