Creating and Managing Form set

You can associate several XDPs or Form Templates, created using Designer, into a form set. Form sets can then be used selectively render the XDPs based on values entered by the users in initial forms and their profiles.

Use AEM Forms user interface to manage all your forms, form sets, and related assets.

Create a form set

To create a form set, do the following:

  1. Select Forms > Forms and Documents.

  2. Select Create > Form Set.

  3. In the Add Properties page, add the following details and click Next.

    • Title: Specifies the title of the document. The title helps you identify the form set in the AEM Forms user interface.
    • Description: Specifies the detailed information about the document.
    • Tags: Specifies tags to uniquely identify the form set. Tags help in searching the form set. To create tags, type new tag names in the Tags box.
    • Submit URL: Specifies the URL where submitted data is posted for the case of stand-alone rendition of form set (Non-AEM Forms app use case). Data is submitted to this endpoint as multipart/formdata with following request parameter:
    • dataXML: This parameter contains an XML representation of submitted form set data. If all forms in the form set use a common schema, the XML is generated as per that schema. Otherwise, XML root tag contains a child tag for each filled form in the form set that contains data for the form attachments.
    • formsetPath: The path of the formset in CRXDE, which has been submitted.
    • HTML Render Profile: You can configure certain options such as floating fields, attachments, and draft support (For stand-alone form set rendition) to customize appearance, behavior, and interactions of the form set. You can customize or extend the existing profile to change any HTML Form profile settings.

    Form set: add properties

  4. The Select Form(s) screen displays the available XDP forms or XDP files. Search and select the forms to include in the form set and then click Add To Form set. If necessary, search again for forms to add. After adding all forms to the form set, click Next.

    NOTE
    Ensure that the field names in XDP forms do not contain the dot character. Otherwise, any scripts trying to resolve the fields, which have dot characters, are unable to resolve them.
  5. In the Configure Form(s) page, you can do the following:

    • Form Order: Drag-and-drop the forms to reorder them. The form order defines the order in which forms are shown to end user in AEM Forms app and stand-alone rendition.
    • Form Identifier: Specifies a unique identity for the forms to be used in eligibility expressions.
    • Data root: For each form in form set, Author can configure the XPATH where the data of that particular form is positioned in submitted XML. By default, the value is /. If all the forms in form set are schema bound and share the same XML schema, you can change this value. It is recommended that every field in form has proper data binding specified in the XDP. If two fields in two different forms share the common data binding, then the field in the second form shows prefilled values from the first form. Do not bind two subforms with the same internal contents to the same XML node. For more information the XML structure of form set, see Prefill XML for Form set.
    • Eligibility expression: Specifies a JavaScript expression that evaluates a Boolean value and indicates whether a form in form set is eligible for filling. If false, user is not asked or even shown the form to fill. Typically, the expression is based on the values of the fields that are captured before this form. Expressions also contain calls to the form set API fs.valueOf to extract the values filled in by the user in a field of a form of the form set:

    fs.valueOf(<Form Identifier>, <fieldSom expression>) > <value>

    For example, if you have two forms in the form set: business expense and travel expense, you can add a JavaScript snippet in the Eligibility Expression field for both of these forms to check user input for type of expense in a form. If the user chooses Business Expense, the Business Expense form is rendered to the end user. Or if the user chooses travel expense a different form is rendered to the end user. For more information, see Eligibility Expression.

    Additionally, the Author may also choose to remove a form from the form set using the Delete icon present at the right corner of each row or add another set of forms using the ‘+’ icon in the toolbar. This ‘+’ icon directs the user back to the previous step in the wizard, that was used to ‘Select Form(s)’. The existing selections are maintained and any additional selection made must be added to the form set using the Add To form Set icon on that page.

    Form set: Configure form (s)

    NOTE
    All the forms that are used in form set are managed by AEM Forms user interface.

Managing a form set

Once a form set is created, you can perform following actions on that form set:

  • Single-click: When form set is created and listed on main asset page, you can single-click the form set to view it. A form set opens and displays all form templates (XDPs) in that form set.
  • Edit: On clicking Edit after selecting a form set, the Configure Form (s) screen that is shown above in Steps to create a Form set opens. You can carry out all the functionalities that are described in point there.
  • Copy + Paste: This allows you to copy the entire form set from one location and paste it at same or any other location or folder.
  • Download: You can download the form set with all its dependencies.
  • Start/Manage Review: Once form set is created, you can set up its review by clicking Start Review. Once review has been started for a form set, Manage Review option is displayed to user. On Manage review screen, you can update/end the review. For the reviews you added, you can check the review and add comments, if necessary.
  • Delete: Deletes the complete form set. The forms in the deleted form set remain in the repository.
  • Publish/Unpublish: This publishes/unpublishes the form set along with the all the forms it contains and the related assets of these forms.
  • Preview: Preview provides two options: Preview as HTML (without data) and custom preview with sample data.
  • View/Edit Properties: You can view/edit the metadata properties of a selected form set.

createformset3

Edit a form set

To edit a form set, do the following:

  1. Select Forms > Forms and Documents.

  2. Locate the form set you want to edit. Hover over it and select Edit ( editicon ).

  3. In the Configure Form(s) page, you can edit the following:

    • Form Order
    • Form Identifier
    • Data root
    • Eligibility expression

    You can also click the relevant Delete icon to delete the form from the form Set.

Form set in Process Management

Once you have created a form set using AEM Forms Management user interface, you can use the form set in a Start Point or Assign Task activity using Workbench.

Using Form set in Task or Start point

  1. When designing a process, under the Presentation & Data section of Assign Task/Start Point, select use a CRX asset. CRX Asset browser appears.

    Design a process: use a CRX asset

  2. Select form set to filter the form set in AEM repository (CRX).

    Design a process: Select Form Asset dialog

  3. Selects a form set and click OK.

Eligibility Expressions

Eligibility expressions in a form set are used to define and dynamically control forms that are displayed to a user. For example, to display a particular form only if the user belongs to a particular age group. Specify and edit an eligibility expression using forms manager.

An eligibility expression can be any valid JavaScript statement that returns a Boolean value. The last statement in the JavaScript code snippet is treated as a Boolean value that determines the eligibility of the form based on the processing in the rest (previous lines) of the JavaScript code snippet. If the value of the expression is true, the form is eligible to be displayed to the user. Such forms are known as eligible forms.

NOTE
Eligibility expression for the first form in form set is not executed. The first form is always displayed regardless of its eligibility expression.

In addition to the standard JavaScript functions, form set also exposes the fs.valueOf API that provides access to the value of a field of a form in a form set. Use this API to access the value of a form field in a form set. The API syntax is fs.valueOf (formUid, fieldSOM), where:

  • formUid (string): A unique ID of a form in the form set. You can specify it while creating the form set in the forms manager user interface. By default, it’s the form name.
  • fieldSOM (string): A SOM expression of the field in the form specified by the formUid. SOM expression or Scripting Object Model expression is used to reference values, properties, and methods within a particular document object model (DOM). You can view it in Form Designer under the Scripts tab while the field is selected.
NOTE
Both formUid and fieldSOM parameters must be string literal.