Formtools Technology
Overview
Formtools combine with metadata described in your content type to dynamically build administration interfaces and displays within FarCry. Formtools can be supplemented or completely replaced by your own hand coded interfaces where needed. But generally their sweet enough to satisfy most UI requirements.
- Anatomy of a Formtool
- Building Forms — FarCry formtools will automate the construction of a default edit form, including the post-form events required to validate and save your data. However, sometimes you need to build your own form – here's how.
- Form Tool Property Metadata
- Form Tool Tag Properties
- Form Tool Usage
- Form Tool Wizard
- Formtool Validation
- Formtools Object Admin — Building a page to list the content items for a specific content type is simplicity itself.
Formtools is a new technology released with FarCry 4.0 (codenamed Gonzales).
Put the Fun Back Into CF Development
FarCry 4.0 introduces a revolutionary new way of developing ColdFusion applications, namely the "formtool". Formtools are a metadata-driven library of UI elements for display and editing. A couple of attributes can transform the functionality of your application. By way of example, take a look at how one line of code can add an image library to your application.
All that magic thanks to...
1. <cfproperty 2. ftseq="10" 3. ftfieldset="Related Content" 4. name="aMedia" 5. type="array" 6. hint="Mixed media content for this content." 7. required="no" 8. ftJoin="dmImage,dmfile,dmflash" 9. ftlabel="Media Library" />
So what? FarCry has a CMS solution bundled with it you say – however, what you are seeing in the video has nothing to do with the CMS plugin. It's actually a simple blog posting application whipped up to demonstrate how things work. I thought it would be nice to add the ability to relate content from the standard image, file and flash libraries that ship with FarCry core.
Having spent all this time helping to build FarCry, it's only recently am I discovering what a joy it is to build things with it.
For fun, how about I post the entire blogging bit of the code base:
- defines the table structure, and deploys to the database of my choice
- dynamically builds the entire edit handler complete with labels, ui elements, fieldsets and more (you can see it in the background of the video)
- provides basic workflow (draft, pending approved)
- adds versioning, archive and roll back for my record
- binds it to the framework categorisation engine
- adds all the image library functionality demonstrated (well actually that just a one liner but heh)
1. <cfcomponent extends="farcry.core.packages.types.versions" displayname="Blog Post" hint="Blog post." bSchedule="true" bFriendly="true"> 2. <!------------------------------------------------------------------------ 3. type properties 4. -------------------------------------------------------------------------> 5. <cfproperty ftseq="1" ftfieldset="General Details" name="Title" type="string" hint="News title." required="no" default="" ftlabel="Title" /> 6. <cfproperty ftseq="3" ftfieldset="General Details" name="publishDate" type="date" hint="The date that a news object is sent live and appears on the public website" required="no" default="" ftDefaultType="Evaluate" ftDefault="now()" ftType="datetime" ftDateFormatMask="dd mmm yyyy" ftTimeFormatMask="hh:mm tt" ftToggleOffDateTime="false" ftlabel="Publish Date" /> 7. <cfproperty ftseq="5" ftfieldset="General Details" name="displayMethod" type="string" hint="Display method to render." required="yes" default="display" fttype="webskin" ftprefix="displayPage" ftlabel="Content Template" /> 8. 9. <cfproperty ftseq="10" ftfieldset="Related Content" name="aMedia" type="array" hint="Mixed media content for this content." required="no" default="" ftJoin="dmImage,dmfile,dmflash" ftlabel="Media Library" /> 10. 11. <cfproperty ftseq="21" ftfieldset="Story Details" name="Body" type="longchar" hint="Main body of content." required="no" default="" ftType="RichText" ftlabel="Body Content" ftTemplateTypeList="dmImage,dmfile,dmflash,dmNavigation,dmHTML" /> 12. 13. <cfproperty ftseq="22" ftfieldset="Story Details" name="teaserImage" type="UUID" hint="Teaser image to display." required="no" default="" fttype="uuid" ftjoin="dmimage" ftlabel="Teaser Image" /> 14. <cfproperty ftseq="23" ftfieldset="Story Details" name="Teaser" type="longchar" hint="Teaser text." required="no" default="" ftlabel="Story teaser" /> 15. <cfproperty ftseq="30" ftfieldset="Categorisation" name="catBlogPost" type="string" hint="Blog categorisation." required="no" default="" fttype="category" ftalias="farblogpost" ftlabel="Blog Category" /> 16. 17. <!--- system attribute ---> 18. <cfproperty name="status" type="string" hint="Status of the node (draft, pending, approved)." required="yes" default="draft" /> 19. 20. </cfcomponent>
Strangely compelling this FarCry caper... Now if only we could work out a way to build cool skeleton apps, introduce complex XML config files, and force CF developers to learn OO – then we might grow up to be a real framework