Adding a Section and a Question Page to an IEG Script

A section and a question page need to be added. A section can be used to group related pages together to allow the user to flow through the screens in a logical manner. Sections can also help to convey to the user their progress through a script. Both the section and the question page can have a title and the question page can optionally have a description.

The following code sample shows a section containing a question page, added to a script:

Figure 1. New Section
<?xml version="1.0" encoding="UTF-8"?>
<ieg-script xmlns:xsi="http://www.w3.org/2001/XMLSchema-in	stance"
	xsi:noNamespaceSchemaLocation="ieg-schema.xsd">
  <identifier id="WorkingWithIEG" scriptversionnumber="V1" 
               type="Intake" />
  <section>
    <title id="AboutYouSection.Title">
      <![CDATA[About You]]>
    </title>
    <question-page id="AboutYouPage" entity="Person">
      <title id="PrimaryPersonPage.Title">
        <![CDATA[About You]]>
      </title>
      <description id="PrimaryPersonPage.Description">
        <![CDATA[Please enter some information about yourself]]>
      </description>
    </question-page>
  </section>
</ieg-script>

The question page requires the appropriate questions to capture the data. Any data to be stored in the DS has to be associated with an attribute of an entity in the DS schema to be used with this script. If all the questions on a page relate to the same entity, the page can be mapped to that entity type. In the above example the page is mapped to the Person entity.

To add questions to a page, a cluster is required. Clusters help control the layout of the questions on the page. A page can contain many clusters to allow you to logically group questions on the page. Clusters may also contain a title and a description.

In our example below, there are two clusters, one just to display some informational text to the user and another to contain the questions for personal details. Questions and display text can be added to each cluster. Questions must be given an ID which must correspond to one of the attributes of the entity type the page is mapped to. If an answer must be supplied to a question the mandatory indicator of the question can be set to true. The script snippet below contains the questions to capture the required data outlined in our example.

Figure 2. Clusters, Questions and Display Text
<question-page ...
    <cluster>
    <display-text id="RequiredFields.Text">
      <![CDATA[<span style="color: orange;">
                * indicates a required field</span>]]>
    </display-text>
  </cluster>
  <cluster>
    <title id="DetailsCluster.Title">
      <![CDATA[Personal Details]]>
    </title>
    <description id="DetailsCluster.Description">
      <![CDATA[Enter your details here]]>
    </description>
    <question id="firstName" mandatory="true">
      <label id="FirstName.Label">
        <![CDATA[First Name:]]>
      </label>
    </question>
    <question id="middleName">
      <label id="MiddleName.Label">
        <![CDATA[Middle Name:]]>
      </label>
    </question>
    <question id="lastName">
      <label id="lastName.Label">
        <![CDATA[Last Name:]]>
      </label>
    </question>
    <question id="gender" mandatory="true">
      <label id="Gender.Label">
        <![CDATA[Gender:]]>
      </label>
    </question>
    <question id="dateOfBirth" mandatory="true">
      <label id="DateOfBirth.Label">
        <![CDATA[Date Of Birth:]]>
      </label>
    </question>
  </cluster>
</question-page>

Please note there are more properties of scripts, sections, question pages, clusters, questions and display texts than are covered here. These properties are covered in the Authoring Scripts using Intelligent Evidence Gathering (IEG) guide some of which will be discussed later in this guide.