Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
{{AVMWarning}}
AVM
Back to WCM Developer Documentation
Forms are used to capture content from the user, store it as XML in Alfresco at a certain path. For capturing content, an XML Schema needs to be created by developer. It is then rendered automatically using a user-friendly Web Form (using XForms technology embedded in Alfresco).
Web Forms are created and administered within the 'Web Forms' space within the Data Dictionary. DM (ECM) Forms are created and administered within the 'Forms' space within the Data Dictionary.
The content contributor will have as few decisions to make as possible when creating content; the majority of the process is automated and configured in advance. A Form is configured by specifying an XML schema to be used by the Form Processor to generate the UI and manage the collected form instance data.
In the case of Web Forms, these can also be configured with rendering engine templates to be used for generating renditions of the collected content. In addition, a default workflow is defined for managing the process by which form instance data and renditions generated by the form are submitted to the staging sandbox.
Forms are used to capture content from the user, store it as XML in Alfresco at a certain path. For capturing content, an XML Schema needs to be created by developer. It is then rendered automatically using a user-friendly Web Form (using XForms technology embedded in Alfresco).
While Alfresco has default form renderings for all types (string, date, etc), it is possible to extend Alfresco and write your own WCM Forms Widgets. An example of why you might want to do that is if you want to create a widget that automatically does automatic suggestions based on an internal data source. The Web Forms can be extended by writing custom WCM Widgets.
When the user is done authoring the Web Form, the resultant XML documents are stored at a pre-specified path.
After the data is captured, it can be 'rendered' in different ways (e.g.: as HTML, PDF, etc.).
After the data is captured as XML, you can either have your site framework read it from alfresco and perform its own rendering, or you can use Alfresco for rendering.
If you decide to use Alfresco for rendering your content (or generating static HTML or HTML fragments), you have two additional steps:
Alfresco now supports forms both in WCM (Web Content Management) and ECM (Enterprise Content Management). Let's examine the terms defined below.
WCM Forms, also known as 'Web Forms', have been available since Alfresco 2.0. These allow structured XML content to be created based on an XML schema (XSD). They also allow multiple renditions to be generated, by configuring one or more template and associated rendering engines.
For a quick tutorial, refer to WCM Forms Quick Tutorial. For a step-by-step tutorial, download the latest WCM Product Evaluation Guide from sourceforge.
ECM Forms, also known as 'DM Forms' or simply 'Forms', are now available in Alfresco 2.9 Community Labs release for testing and evaluation. These allow structured XML content to be created based on an XML schema (XSD). Unlike 'Web Forms', they do not directly support renditions although Content Transformations can be used to achieve similar results.
Refer to ECM Forms for basic steps to define and use a form.
Alfresco ships with a single form processor and two different rendering engines. The form processor isn't pluggable yet; however, the two bundled rendering engines can co-exist (and more might be added later). Meta information is associated with renditions so the Alfresco web application's 'edit' functionality is intelligent: editing a rendition is interpreted as opening its associated form user interface, pre-populated with the form instance data used to create the rendition. When editing form instance data, on saving the changes Alfresco will automatically regenerate renditions. If the form definition is changed then it is also possible to explicitly choose to regenerate renditions by invoking the associated wizard.
When content is created based on a form, Alfresco needs to know where to store the resultant files. Each form has ability to set output paths for the resultant files.
Output path patterns are used to define where web form instance data and renditions are saved in the repository. They are intended to be used for enforcing the structure of the web project. Output Path Patterns are FreeMarker expressions that are evaluated once the contributor has entered in the form instance data and the content and renditions are ready to be saved. Below are the variables available to these expressions and some examples.
name | value |
---|---|
name | foo |
extension | html |
webapp | ROOT |
cwd | /d1/d2 |
date | Sat Sep 01 2007 13:33:59 GMT-0700 (PDT) |
xml |
|
output path pattern | output path |
---|---|
${name}.xml | /ROOT/d1/d2/foo.xml |
${name}.${extension} | /ROOT/d1/d2/foo.html |
/${name}.${extension} | /foo.html |
/${webapp}/renditions/${name}.${extension} | /ROOT/renditions/foo.html |
/${webapp}/renditions/${date?string('MM')}/${name}.${extension} | /ROOT/renditions/09/foo.html |
/${webapp}/renditions/${date?string('yyyy')}/${cwd}/${name}.${extension} | /ROOT/renditions/2007/d1/d2/foo.html |
${xml.root_tag.name}.xml | /ROOT/d1/d2/bar.xml |
${xml['root_tag/name']}.xml | /ROOT/d1/d2/bar.xml |
/${webapp}/${xml.root_tag.date?date('yyyy-MM-dd')?string('yyyy')}/${name}.xml | /ROOT/1776/foo.xml |
${xml['root_tag/node-name-with-dash']}.xml | /ROOT/d1/d2/moo.xml |
${xml['root_tag/myns:namespaced']}.xml | /ROOT/d1/d2/cow.xml |
See the Alfresco demo website for details on how to use
ServletContextFormDataFunctionsAdapter, parseXMLDocument, and parseXMLDocuments (particularly, look at the comments within the jsp files).
These are linked to above already, this is another set of related links.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.