3.4 Forms Development Kit

Showing results for 
Search instead for 
Did you mean: 

3.4 Forms Development Kit

0 0 4,271

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com


NOTE: This document details the Forms Development Kit in the 3.4 Release, for the latest documentation click here.


Welcome to the Alfresco Forms Development Kit (FDK).

The Alfresco FDK was introduced in the 3.3 release, it provides support for administrators and developers who wish to configure, extend or customize forms in Spring Surf based applications, for example, Share.

Getting Started

Installing the AMP

The AMP (alfresco-fdk.amp) can be installed into the alfresco.war file using the normal techniques, either with the Module Management Tool or using the apply_amps script provided with the installer.

Installing the JAR

Presuming the Tomcat instance you are using has been configured to use the shared folder you can simply drop the  JAR file (alfresco-fdk.jar) into <tomcat>/shared/lib.

You can of course drop the JAR file into  the application's WEB-INF/lib folder too i.e. <tomcat>/webapps/<appname>/WEB-INF/lib but this will be removed when you update or upgrade your application so the technique above is recommended.

If you are installing the FDK into an older Spring Surf application that does not contain the required import statement the fdk-context.xml file can be manually added to your application using the following import:

<import resource='classpath:alfresco/fdk-context.xml'/>

Building the FDK

If you are building Alfresco from source using a development environment you may wish to also build and deploy the FDK.

The main Ant build.xml file provides several targets to allow for this.

Builds the repository and client FDK files

Builds the FDK AMP and installs it in the repository WAR file, the 'deploy-webclient-tomcat' needs to be called subsequently to deploy the WAR file to Tomcat

Deploys the FDK repository files to Tomcat in exploded mode

Builds the FDK client JAR and deploys it to Share

Deploys the FDK client files to Share in exploded mode

Using the FDK

The AMP installs an example model and the JAR provides a 'Form Console' page, form configuration for the example model, a unit test page and some Share specific configuration overrides.

The 'Change Type' action in Share will now have three options (for cm:content nodes), 'Gadget', 'Company Details' and 'Everything'.

The FDK also provides an extension point (alfresco/web-extension/fdk-config-custom.xml) so that further form configuration can be provided and tested via the form console page.

A landing page is provided, available at http://localhost:8080/share/page/fdk (presuming you are using a default Alfresco installation) which provides links to the Form Console and Unit Tests pages

Form Console

If you've worked with forms in the 3.2 release you may recognize the Form Console as the old form-test page available in Share. It has now been renamed and moved to the FDK so it can be used in any Spring Surf based application.

The 'Form Console' page can be accessed via the following URL:
for example: http://localhost:8080/share/page/form-console if you are using a default installed Alfresco instance.

All the unit tests added to the FDK in this release make use of the Form Console, the screenshot below shows the Form Console displaying the 'nested-sets' form configuration.


All the unit test form configurations are supplied in a file named 'fdk-unit-tests-config.xml', this can be a useful source of examples. The 'fdk-config-custom.xml' file mentioned above can be used to define more forms for further testing.


In it's current state the FDK provides a demonstration of what can be done with some of the features of the forms engine, all the samples previously distributed with Share have been moved into the FDK and made available in an easy to install package, this includes most the examples from Episode 35 of Tech Talk Live where the forms engine was discussed and demonstrated.

The following sections show a few screenshots and configuration of the example forms.

Gadget Type

When an instance of the 'Gadget' (fdk:gagdet) type is created and it's metadata edited the following form is displayed.


The configuration required to achieve this is shown below.

<config evaluator='node-type' condition='fdk:gadget'>
         <edit-form template='/fdk/templates/tab-edit-form.ftl' />
            <show id='cm:name' />
            <show id='cm:description' />
            <show id='fdk:make' />
            <show id='fdk:model' />
            <show id='fdk:summary' />
            <show id='fdk:type' />
            <show id='fdk:subType' />
            <show id='fdk:rrp' />
            <show id='fdk:releaseDate' />
            <show id='fdk:endOfLifeDate' />
            <show id='fdk:retailers' />
            <show id='fdk:rating' />
            <show id='fdk:contact' />
            <show id='fdk:reviews' />
            <show id='fdk:company' />
            <show id='fdk:pressRelease' />
            <show id='fdk:images' />
            <set id='' label-id='fdk.tab.label.details' />
            <set id='press' label-id='fdk.tab.label.press' />
            <field id='cm:description'>
               <control template='/org/alfresco/components/form/controls/richtext.ftl' />
            <field id='fdk:model'>
               <control template='/fdk/controls/autocomplete.ftl'>
                  <control-param name='ds'>/service/ds/autocomplete/google</control-param>
            <field id='fdk:releaseDate' set='press' />
            <field id='fdk:endOfLifeDate' set='press' />
            <field id='fdk:retailers' set='press' help-id='fdk.help.gadget.retailers' />
            <field id='fdk:rating' set='press' />
            <field id='fdk:contact' set='press' />
            <field id='fdk:reviews' set='press' />
            <field id='fdk:company' set='press' />
            <field id='fdk:pressRelease' set='press' />
            <field id='fdk:images' set='press' />

Company Type

When an instance of the 'Company' (fdk:company) type is created and it's metadata edited the following form is displayed.


The configuration required to achieve this is shown below.

<config evaluator='node-type' condition='fdk:company'>
         <edit-form template='/fdk/templates/2-column-edit-form.ftl' />
            <show id='cm:name' />
            <show id='fdk:email' />
            <show id='fdk:url' />
            <show id='fdk:tel' />
            <show id='fdk:street1' />
            <show id='fdk:street2' />
            <show id='fdk:city' />
            <show id='fdk:county' />
            <show id='fdk:state' />
            <show id='fdk:postCode' />
            <show id='fdk:zip' />
            <show id='fdk:country' />


In the 3.4 release a standard out-of-the-box EXIF aspect has been added. The 'fdk:exif' aspect provided by the FDK has therefore been deprecated.

When either the EXIF or dublin core aspects are applied to a cm:content node the FDK assigns their fields to a set and provides a custom set template. The dublin core fields are shown in 2 columns and the EXIF fields are displayed within an accordion control as shown in the screenshot below.


The configuration required to achieve this is shown below.

<config evaluator='node-type' condition='cm:content'>
            <set id='dublin-core' appearance='' template='/fdk/templates/custom-set-dublincore.ftl' />
            <set id='exif' appearance='' label-id='fdk.tab.label.exif' template='/fdk/templates/custom-set-exif.ftl' />

            <field id='cm:publisher' set='dublin-core' />
            <field id='cm:contributor' set='dublin-core' />
            <field id='cm:type' set='dublin-core' />
            <field id='cm:identifier' set='dublin-core' />
            <field id='cm:dcsource' set='dublin-core' />
            <field id='cm:coverage' set='dublin-core' />
            <field id='cm:rights' set='dublin-core' />
            <field id='cm:subject' set='dublin-core' />
            <field id='exif:dateTimeOriginal' set='exif' />
            <field id='exif:pixelXDimension' set='exif' />
            <field id='exif:pixelYDimension' set='exif' />
            <field id='exif:exposureTime' set='exif' />
            <field id='exif:fNumber' set='exif' />
            <field id='exif:flash' set='exif' />
            <field id='exif:focalLength' set='exif' />
            <field id='exif:isoSpeedRatings' set='exif' />
            <field id='exif:manufacturer' set='exif' />
            <field id='exif:model' set='exif' />
            <field id='exif:software' set='exif' />
            <field id='exif:orientation' set='exif' />
            <field id='exif:xResolution' set='exif' />
            <field id='exif:yResolution' set='exif' />
            <field id='exif:resolutionUnit' set='exif' />

Left Aligned Labels

By default field labels are rendered above the field they represent. Although there is a lot of evidence from user studies to support this approach as being the most favorable in terms of user experience it's not to everyone's taste. The FDK provides a small CSS file as an example that moves the labels to the left of the field as shown in the screenshot below.


The configuration required to achieve this is shown below.

         <css src='/fdk/left-aligned-label.css' />

Unit Tests

The 3.4 release of the FDK added an 'FDK Unit Tests' page, it can be accessed via the following URL:
for example: http://localhost:8080/share/page/fdk-unit-tests if you are using a default installed Alfresco instance.

The FDK Unit Tests page provides a myriad of pre-configured examples to test the various features and capabilities of the forms engine. The NodeRef of an instance of an fdk:everything node has to be provided after which any link can be clicked to see the corresponding form. Each test uses the Form Console page with a form id from the fdk-unit-tests-config.xml file.

The screenshot below shows the tests available.


XML Schema

The FDK also provides an XML schema describing the XML vocabulary for form configuration. To access the schema you'll need to checkout the source code from SVN. You'll find the schema in the root/projects/fdk/utils folder.

The schema only represents the forms configuration options so you will have to have a separate config file for your forms configuration otherwise the schema will incorrectly report errors against other Alfresco config.


  • Improve Form Console
  • Forms Runtime examples
  • Form building utilities
  • Simple Form Builder