Form Definition Files

Each form definition file has the same structure and the format must be adhered to. Form names should be of the format formname.json and can be stored anywhere within the Forms folder structure. For organizational purposes, a MyForms folder is provided to storing your form definition files.

The basic structure

The form example shown above is defines the file titled Test.json containing the defining key value pairs used for creating the form. for formData.
The javascript object literal (often referred to as a JSON object is assigned to the variable formData that is injected into the application as a javascript objects when the form is selected. This "JSON" object is like a javascript object except that the key values are surrounded with double quotes and any string values must have double-quotes surrounding them. Each object refers to a single form.

The values used in a form definition object can be either string, number or an array depending on the field requirements as defined in the Field Definitions section.

formData = {
"legendName": "Form",
"PreText": ["Red fields are required fields",0],
"PostText": ["A Copy of your completed submission will be in your mailbox.",1],
"formFields": [
{
"Label":"Name:",
"FieldDataID":"NameID",
"width": 300,
"Type":"text",
"Placeholder": "Enter your name",
"required" : 1
},
{
"Label":"Check as many as you like",
"FieldDataID":"chkboxID",
"Type":"checkbox",
"CbxValues": [
"Red",
"Green",
"Blue",
"White"
],
},
{
"Label":"Phone Number",
"FieldDataID":"PhoneID",
"width": 300,
"Type":"text",
"Pattern":"^([\\(]{1}[0-9]{3}[\\)]{1}[ ]{1}[0-9]{3}[\\-]{1}[0-9]{4})$",
"Placeholder": "(###) ###-####",
"required" : 0
}
]
}

The Header

The header portion of the object contains three key value pairs.

  1. The "legend Name" key's value is used as the legend that surrounds the form fields
  2. The "PreText" key's value is an array containing text that is presented before the form data. The second item of the array is either a 0 or 1. If it is 0, the resulting email will not contain the text. If the value is 1, the resulting email post will contain the PreText text string.
  3. The "PostText" key's value is an array containing text that is presented after the form data. The second item of the array is either a 0 or 1. If it is 0, the resulting email will not contain the text. If the value is 1, the resulting email post will contain the PostText text string.

FormFields

The "formfields" key value is an array of "JSON" objects with each object defining a field on the form. The order in which they are listed is the order in which they will appear on the form. Please see the Field Definitions section for the format required for each field type.

Note

It is important to ensure that all keys have quotes around them and that you have commas separating each key value pair except for the last one and that all arrays have opening and closing brackets. Each of the keys are also case sensitive so it might be advisable to cut and paste from the samples and modify as needed.

Previous Page: The Form Presentation File (forms.json) Table of Contents Next Page: Field Definitions