Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Page layout facilities > Templates > Writing templates > Questions, responses, and error messages
 
Questions, responses, and error messages
In a template, a question consists of a banner; a question text (label); a response control; and an error message. You can display these items anywhere on the page, and in any order on the page.
Displaying a question
To display a question on a page, put the following statement in the template at the point you want the question text to start:
<mrData/>
This displays the question text with the response control indented under it. If the respondent answers the question incorrectly, an error message displays above the question.
The interviewing program inserts line breaks between the error message, the question text, and the response control.
If there is more than one question to display on the page, the questions and their response controls are displayed one after the other down the page.
More control over how the questions are displayed
For more control over the way the questions are displayed, use the fuller form of the tag. You can include any combination of the listed attributes in a single instance of the tag if required.
Syntax
<mrData [Index='number'] [QuestionElement='Qpart' [ShowErrors='Errtype']]
[AutoComplete='TrueFalse']> [Text] </mrData>
Parameters
number
A number that identifies individual questions on a page that needs to display more than one question.
Qpart
Specifies which part of the question to display at the current location, and is one of:
Qpart
Description
Banner
Question banners
Controls
Response list or input box
Error
Error message
Label
Question text
Parameter
Information for a custom control. For more information, see Custom controls.
Errtype
Specifies which error messages to display for questions in loops and blocks, and is one of:
Errtype
Description
All
All errors
BottomMost
Bottom level errors only (default)
TopAndBottomMost
Top and bottom level errors
TopMost
Top level errors only
To change the default from BottomMost, add the ShowErrors element on both the Error QuestionElement and the Controls QuestionElement.
For more information, see Error messages for questions in loops and blocks.
TrueFalse
Determines whether auto-completion is enabled for the question. This feature applies only to the Internet Explorer browser and is disabled by default.
Text
Text of your choice. The interviewing program ignores this text, but it is useful if you want to test your template by opening the .htm file in your browser. In this case, the text appears in the position and with the attributes defined in the file.
Laying out the components of a question
Each question has four components: an optional banner defined in a separate information item, a text, a response list or input box, and, when appropriate, an error message. You can specify the positions of these components on the page by typing:
<mrData QuestionElement='Qpart']> [Text] </mrData>
Qpart
Specifies which part of the question to display at the current location and is one of:
Qpart
Description
Banner
Question banners
Controls
Response list or input box
Error
Error message
Label
Question text
Parameter
Information for a custom control. For more information, see Custom controls.
Text
Text of your choice. The interviewing program ignores this text, but it is useful if you want to test your template by opening the .htm file in your browser. In this case, the text is displayed in the position and with the attributes defined in the file.
Example
To display error messages between the response control and the navigation bar, put the following statements in the template file:
<mrData QuestionElement='Label'/>
<mrData QuestionElement='Controls'/>
<mrData QuestionElement='Error'/>
<mrNavBar>
If the respondent clicks Next without choosing an answer, the page that this template generates is:
This graphic is described in the surrounding text.
There are two things in this page layout that are not a result of the instructions in the template:
The response list is indented, while the template shows it in line with the start of the question and error texts. This is because the system default is to indent response controls. If you want the response control lined up with the left of the page, set the indentation to zero (or even to a negative value if necessary) by placing a statement such as:
IOM.DefaultStyles.Questions[..].Style.Indent=-1
in the routing section of the script. For more information, see Indenting response lists.
The error message is in bold red type when nothing is specified in the template. This is the system default. If you want to change this you should do so in the interview script. For example, for purple, italic error messages you would type:
With IOM.DefaultStyles.Labels[LabelStyleTypes.lsError]
.Color = "#800080"
.Font.Effects = FontEffects.feItalic
End With