Entity view (Content)

Autocomplete Fields in Alfresco

By paladro
Jul. 8, 2015

Sometimes Alfresco developers need to define constraint list properties in Alfresco with a large number of values. For this type of metadata fields, the form layout is quite useless, as we need to search for a particular value in a long list of values (i.e. <50).

To make this easier, we have used the YUI autocomplete widget to create a new form control (autocomplete.ftl) for this type of properties.

Based on the selectone.ftl control, we have added this code to the template:

...

And here is the javascript code for this component, autocomplete.js:

 

Then we just need to specify in share-config-custom.xml which properties are using this form control:

 

<field id="my:contractListValues">
<control template="/org/alfresco/components/form/controls/autocomplete.ftl">
<control-param name="showOptions">true</control-param>
</control>
</field>

 

Post Tags: