Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Page layout facilities > Templates > Displaying response controls side by side with question text > Error messages for questions in loops and blocks
Error messages for questions in loops and blocks
When a respondent answers a question in a loop or a block incorrectly, there is usually more than one message that can be displayed. The default is to display messages related to the question itself, as shown in the following illustration, but you can display other messages as well:
Three-dimensional grid with messages for the repeated question only
This graphic is described in the surrounding text.
The interviewing program generates one message related to the question itself and then a further message for each level of nesting, so the number of messages you can display depends on how deeply the question is nested. For example, if you have a loop that contains an inner loop, and the respondent incorrectly answers a question in the inner loop, there will be one message for the question and one for each of the loops, making three messages in all. You can use the ShowErrors attribute of the <mrData> tag to specify which messages you want to display:
<mrData QuestionElement='Error' ShowErrors='Errtype']> [Text] </mrData>
One of:
All messages.
Messages for the question level only (the default).
Messages for the question and outermost levels only.
Messages for the outermost level only.
Any 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 will be displayed in the position and with the attributes defined in the file.
If you add the tag:
<mrData QuestionElement="Error" ShowErrors="All"/>
to the template and rerun the previous example, you will see an additional error message for the loop as a whole:
Three-dimensional grid with all messages displayed
This graphic is described in the surrounding text.
See also
Writing templates