Adding form elements to metadata

Perform the following steps to add an element in the metadata:

  1. Open your adaptive form in edit mode.
    To open your form in edit mode, in the forms manager, select your form and select Open.

  2. In the edit mode, select a component, select field-level > Adaptive Form Container, and then select cmppr .

  3. In the sidebar, click Metadata.

  4. In the Metadata section, click Add.

  5. Use the Value field of the Metadata tab to add scripts. The scripts you add collect data from elements on the form and compute values that are fed to the metadata.

    For example, true is logged in the metadata if age entered is greater than 21, and false is logged if it is less than 21. You enter the following script in the Metadata tab:

    (agebox.value >= 21) ? true : false

    Metadata script

    Script entered in the Metadata tab

  6. Click OK.

After a user enters data in the element selected as a metadata field, the computed information is logged in the metadata. You can see the metadata in the repository you configured to store metadata.

Seeing updated form submission metadata:

For the example above, the metadata is stored in the CRX repository. The metadata looks like:

Metadata

If you add a check box element in the metadata, selected values are stored as a comma separated string. For example, you add a check box component in your form, and specify its name as checkbox1. In the check box component properties, you add the items Driving License, Social Security Number, and Passport for values 0, 1, and 2.

Storing multiple values from a check box

You select adaptive form container, and in the form properties you add a metadata key cb1 which stores checkbox1.value, and publish the form. When a customer fills the form, the customer selects Passport and Social Security Number options in the check box field. The values 1 and 2 are stored as 1, 2 in the cb1 field of the submission metadata.

Metadata entry for multiple values selected in a checkbox field

NOTE
The above example is for learning purpose only. Ensure that you look for metadata in the correct location as configured in your AEM Forms implementation.

Experience Manager


Espressos & Experience Manager: AEM Forms

Espressos & Experience Manager

Thursday, Mar 6, 7:00 PM UTC

Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.

Register

Elevate and Empower Teams with Agentic AI for Exceptional Experiences

Online | Strategy Keynote | General Audience

Elevate and empower your CX teams with AI that transforms creativity, personalization, and productivity. Discover how Adobe is...

Tue, Mar 18, 1:00 PM PDT (8:00 PM UTC)

Register

Put the Customer at the Center and Build Relationships That Last a Lifetime

Online | Strategy Keynote | General Audience

First impressions last a lifetime. Great first impressions feel personal, connected, and relevant right from the start. From the first...

Wed, Mar 19, 2:30 PM PDT (9:30 PM UTC)

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more