Desktop User Guides > Professional > Interview scripting > Interview scripting reference > Default templates > Default question template > Responses to questions in grids
 
Responses to questions in grids
Grids can contain subquestions with categorical, numeric, or text answers. However, the HTML code that renders the grid is generally the same for all types of subquestion, apart from the code that draws the radio button, check box, or input box in each cell.
Categorical subquestions
The HTML code for a categorical subquestion is as follows:
<tr>
  <td></td>
  <td class="mrGridQuestionText" style="text-Align:
       Center;vertical-align: Middle;">
    <span class="mrQuestionText" style="">ColHead</span>
  </td>
  Other column headings</tr>
<tr>
  <td class="mrGridCategoryText" style="text-Align:
       Left;vertical-align: Middle;">
    <span class="mrQuestionText" style="">RowText</span>
  </td>
  <td style="text-Align: Center;vertical-align: Middle;">
  <div></div>
  <input type="SelectionType" name="CellID" class="AnswerType"
      style="" value="ColHead1"></input>
  </td>
  Other cells in row 1
</tr>
Specifications for other rows
where:
ColHead is the column heading text. There will be one <td> tag for each column.
RowText is the row heading text. There will be one <tr> tag for each row.
SelectionType is radio for single-choice responses or checkbox for multiple-choice responses.
CellID is the unique name for the current grid cell. UNICOM Intelligence Interviewer - Server creates this as _Qloopname_Qloopcat_Qqname_Ccatname, where loopname is the name of the main loop (grid) question, loopcat is the current item in the loop control list (the current column), qname is the name of the repeated question, and catname is the name of the current category in that question's response list (the current row text). The following example makes this naming convention clearer.
AnswerType is mrSingle for single-choice responses or mrMultiple for multiple-choice responses.
Example
For example, if the question is:
WhereFrom "Which country or countries produce ...?" loop
{
Gunpowder, Oolong, Puerh, Rooibos
} fields
(
Country "" categorical [1..]
{
China, India, Japan, Kenya,
CountryDK "Don't know"
};
) expand grid;
the first two column headings (China and India) and response rows (Gunpowder and Oolong) become:
<span class="mrQuestionText" style="">Which country or countries produce ...?</span>
<div><br/></div>
<div></div>
<span style="display: inline-block;">
<table summary="Which country or countries produce ...?" class="mrQuestionTable" style="">
<tr>
<td></td>
<td class="mrGridQuestionText" style="text-Align: Center;vertical-align: Middle;">
<span class="mrQuestionText" style="">China</span>
</td>
<td class="mrGridQuestionText" style="text-Align: Center;vertical-align: Middle;">
<span class="mrQuestionText" style="">India</span>
</td>
...
>/tr>
<tr>
<td class="mrGridCategoryText" style="text-Align: Left;vertical-align: Middle;">
<span class="mrQuestionText" style="">Gunpowder</span>
</td>
<td style="text-Align: Center;vertical-align: Middle;">
<div></div>
<input type="checkbox" name="_QWhereFrom_QGunpowder_QCountry_CChina" class="mrMultiple" style="" value="China"></input>
</td>
<td style="text-Align: Center;vertical-align: Middle;">
<div></div>
<input type="checkbox" name="_QWhereFrom_QGunpowder_QCountry_CIndia" class="mrMultiple" style="" value="India"></input>
</td>
...
</tr>
<tr>
<td class="mrGridCategoryText" style="text-Align: Left;vertical-align: Middle;">
<span class="mrQuestionText" style="">Gunpowder</span>
</td>
<td style="text-Align: Center;vertical-align: Middle;">
<div></div>
<input type="checkbox" name="_QWhereFrom_QOOlong_QCountry_CChina" class="mrMultiple" style="" value="China"></input>
</td>
<td style="text-Align: Center;vertical-align: Middle;">
<div></div>
<input type="checkbox" name="_QWhereFrom_QOOlong_QCountry_CIndia" class="mrMultiple" style="" value="India"></input>
</td>
...
</tr>
...
</table>
</span>
After a snapback or restart, any answers that were chosen in the original portion of the interview will have the checked="" attribute in their definition so that the appropriate radio button or check box is preselected when the question is displayed. For more information, see Categorical responses.
See also
Numeric and text subquestions
Default question template