Adding form elements to metadata
Perform the following steps to add an element in the metadata:
-
Open your adaptive form in edit mode.
To open your form in edit mode, in the forms manager, select your form and tap Open.
-
In the edit mode, select a component, tap
-
In the sidebar, click Metadata.
-
In the Metadata section, click Add.
-
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
Figure: Script entered in the Metadata tab -
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:
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.
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.