Skip to content

5. Form Specification

Elly Kitoto edited this page Jul 9, 2020 · 2 revisions

Understanding form

A form is basically a collection of views. A form can have views grouped together in one logical section referred to as a Step. Each step has a navigation button to take you to the next step or move back to the previous one. In addition each form with a step has a complete action that is invoked when your reach its end. You can use this action to submit the data obtained from the form.

You can as well pass additional data to the form via the form_meta_dataattribute.

Below are the current supported attributes that you for forms and step.

Form attributes

Form Attribute Usage Required
form Name of your form Yes
rules_file Path to the file containing the rules for handling skip logic and calculation No
steps The form steps with the desired fields Yes
metadata/meta_data Additional information that you would also like to pass with the form when submitting data No

Step attributes

Form Attribute Usage Required
title Title of the step Yes
fields Array of fields (views) to display on the step Yes

Resulting JSON

{
  "form": "Profile",
  "form_version": "1.0.0",
  "rules_file": "rules/yml/sample_one_form_rules.yml",
  "steps": [
    {
      "title": "Demographics",
      "fields": [
        {
          "name": "adult",
          "type": "text_input_edit_text",
          "properties": {
            "hint": "Enter adult's phone number",
            "type": "name"
          },
          "subjects": "age:number, child:text",
          "required_status": "Yes:please add phone number"
        }
      ]
    }
  ]
}

NOTE: a form must have at least one step.