Working knowledge of HTML and CSS
The AEM Forms user interface lets you add metadata to any form. Custom metadata can enhance user experience while listing and searching forms of your organization.
Forms Portal lets you use custom metadata in form listings. While creating custom templates for assets, you can modify their layout and use custom metadata with your CSS style set.
Perform the following steps to create a custom template for various Forms Portal components.
Create a sling:Folder node under /apps
Add a “fpContentType” property. Specify appropriate values for the property depending on the component for which you are defining the custom template.
Search & Lister component: “/libs/fd/fp/formTemplate”
Drafts & Submissions Component:
Link Component: /libs/fd/fp/linkTemplate
Add a title that you want displayed while selecting layout templates.
The title can be different from the node name of sling:Folder you created.
The following image depicts the configuration for the Search & Lister component.
Create a file template.html in this folder to serve as the custom template.
Write the custom template and use custom metadata as described below.
The following is a sample implementation of a custom template where Forms Portal acquires a custom Geometrixx Gov Card Layout for the Search & Lister component.
<div class="__FP_boxes-container __FP_single-color">
<div class="boxes __FP_boxes __FP_single-color" data-repeatable="true">
<div class="__FP_boxes-thumbnail">
<img src ="${path}/jcr:content/renditions/cq5dam.thumbnail.319.319.png"/>
</div>
<h3 class="__FP_single-color" title="${name}" tabindex="0">${name}</h3>
<p>${description}</p>
<div class="boxes-icon-cont __FP_boxes-icon-cont">
<div class="op-dow">
<a href="${formUrl}" target="_blank" class="__FP_button ${htmlStyle}" title="${config-htmlLinkText}">${localize-Apply}</a>
<a href="${pdfUrl}" class="__FP_button ${pdfStyle}" title="${config-pdfLinkText}">${localize-Download}</a>
</div>
</div>
</div>
</div>
A custom template for any Forms Portal component includes repeatable and non-repeatable entries. Repeatable entries are basic entities for listing. Examples of repeatable entries are Search & Lister, Drafts & Submissions, and Link components.
Forms Portal provides a syntax for place-holders to display custom/OOTB metadata. The placeholders are populated after displaying the results of forms, drafts, or submissions.
To include a repeatable entry, configure the value of the attribute data-repeatable to true.
In the example discussed, two Div elements are present at the top in the custom template. The first, with “__FP_boxes-container” CSS class, works as a container element for the forms that are listed. The second, with “__FP_boxes” CSS class, is a template for the basic entities, in this case a Form. The data-repeatable attribute present in the Div element has the value true.
Each placeholder has an exclusive OOTB metadata set. To display custom metadata at a particular place on the form, add the ${metadata_prop} property at the place.
In the example, the metadata property is used at multiple instance. For example, it is used in description, name, formUrl, htmlStyle, pdfUrl, pdfStyle, and path in the prescribed manner.
Various Forms Portal components provide exclusive sets of OOTB metadata that you can use for listing.
Title: Title of the form
name: Name of the form (mostly it is the same as the title)
description: Description of the form
formUrl: URL to render the form as HTML
pdfUrl: URL to render the form as PDF
assetType: Type of the asset. Valid values include Form,PDF Form, Print Form, and Adaptive Form
htmlStyle & pdfStyle: Display style for HTML and PDF icons respectively used for rendering. Valid values are "__FP_display_none" or blank.
Remember to use the __FP_display_none class in your custom style sheet.
Support for localization, sorting, and using configuration properties on the user interface (Search & Lister Only):
Localization Support: To localize any static text use the attribute ${localize-YOUR_TEXT}
and make the localized value available, if doesn’t exist already.
In the example discussed, the attributes ${localize-Apply}
and ${localize-Download}
are used to localize the Apply and Download text.
Support for Sorting: Click the HTML element to sort search results. To implement sorting in a tabled layout, add the “data-sortKey” attribute on the particular table header. In addition, add its value as the metadata for which you want to sort.
For example, for the “Title” header in the grid view, the value of the “data-sortKey” header is “title”. Click the heading to sort the values in a particular column.
Using configuration properties: The Search & Lister component has several configurations that you can use on the user interface. For example, to display HTML ToolTip text saved through the edit dialog, use the ${config-htmlLinkText}
attribute. Similarly, for PDF tool tip text, use the ${config-pdfLinkText}
attribute.
Note:
For the delete option in the Drafts section under the Drafts & Submissions component, name the CSS class “__FP_deleteDraft.” In addition, include the attribute “draftID” with the value ${draftID}, which is the draft id of corresponding draft.
While creating links to open drafts and submissions, you can specify ${path}.html as the value of the href attribute for the anchor tag.
A. Container element
B. “path” metadata with a fixed hierarchy to obtain the thumbnail stored for each form.
C. Data-repeatable attribute used for the template section for each form
D. To localize “Apply” string
E. Using the configuration property pdfLinkText
F. Using the “pdfUrl” metadata