Alternatives to Alfresco Share for building Generic Forms

Alfresco introduced Share, it’s own collaboration portal based on Spring Surf technology and they have a pretty good idea to reduce the coding effort for building forms for your custom data types. It is called Forms Engine.

The following diagram pretty much explains the whole idea. You have services on Alfresco side that can return metadata about a particular node for form creation, persist the form, validate the posted values, etc.

In between you have some facilities on Share that can render the form and consume the configuration using this underlying services.

And finally on browser side you have forms engine that can manage the rendered form, client side validations, fancy AJAX interactions, etc.

alfresco share alternatives

See the following steps taken from Forms Developer Guide that explains the flow in detail.

  1. The browser requests a page that contains the Form UI Component.
  2. The Form UI Component uses the ConfigService to look for XML form configuration for the item requested.
  3. If configuration was found for the item a list of fields to be displayed is determined and passed to the formdefinitions REST API, if no configuration is found the REST API is called without any parameters.
  4. The formdefinitions REST API calls the JavaScript FormService.
  5. The JavaScript FormService calls the Java FormService. To process the request an appropriate FormProcessor for the item “kind” is located and asked to generate a form definition. During this process one or more Filters may be called to further process the generated form. The REST API receives the form definition and generates a JSON representation.
  6. The Form UI component takes the JSON form definition and combines it with the form configuration retrieved earlier to produce a Form UI template model. The FreeMarker template is then processed to produce the HTML/JavaScript output that is sent back to the browser. The browser executes the returned HTML/JavaScript which instantiates the Forms Runtime object used to manage the generated form.

But Share is not the only option to use if you want something similar. You could continue to use your favorite UI framework and provide the same flexibility.

Take the following webscript as an example, what it does it to dump the metadata of a given node recursively. It outputs everything you need about that particular node, the attributes, the type of the attributes, the relationships, aspects, etc.

It is even better than the one provided Alfresco by default, because this webscript returns all the metadata about a node recursively including all the children nodes which also enables you to build nested forms.

READ  Tips and Tricks in PHP

What you have to know is to develop a form builder for your favorite UI framework of your choice. For example I developed a generic form builder for GWT using the output coming from this webscript. You are not bound to Share 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *