Difference between revisions of "Show more than one questions in the same page"

From Catglobe Wiki
Jump to: navigation, search
(Solutions)
m (Solutions)
Line 7: Line 7:
 
= Solutions =
 
= Solutions =
  
The main idea is that when we want to display a question not in its own page, there must be an input element added to that page's html with name following a specific format, non grid question should have name as QUESTION.question_label, grid questions use names as QUESTION.question_label.grid_index
+
The main idea is that when we want to display a question not in its own page, there must be an input element added to that page's html with name following a specific format: non grid question should have name as QUESTION.question_label, grid questions use names as QUESTION.question_label.grid_index
  
Example 1:
+
<b>Example 1:</b>
  
 
I want to show my single question labeled Q1 in another question with radio buttons, I need to make sure the HTML contains the following code for each answer option.
 
I want to show my single question labeled Q1 in another question with radio buttons, I need to make sure the HTML contains the following code for each answer option.
Line 25: Line 25:
 
</source>
 
</source>
  
Example 2:<br/>
+
<b>Example 2:</b><br/>
 
I want to show a single grid question label Q1 in another question, I need to make sure the HTML contains the following code for each answer option and each sub question. Q1 has 2 answer options<br/>
 
I want to show a single grid question label Q1 in another question, I need to make sure the HTML contains the following code for each answer option and each sub question. Q1 has 2 answer options<br/>
 
<source lang=html4strict>
 
<source lang=html4strict>

Revision as of 08:15, 8 March 2010

Introduction

There is a common need of showing more than one questions in the same page, but unfortunately it is not supported by the current editor (we hope it will be possible with the new viewer in a near future)

In the mean time, we need to have some work-arround tips to make it work.

Solutions

The main idea is that when we want to display a question not in its own page, there must be an input element added to that page's html with name following a specific format: non grid question should have name as QUESTION.question_label, grid questions use names as QUESTION.question_label.grid_index

Example 1:

I want to show my single question labeled Q1 in another question with radio buttons, I need to make sure the HTML contains the following code for each answer option.

<tr>
   <td width="16px" valign="top" align="center">
      <input type="radio" value="1" name="QUESTION.Q1">
   </td>
   <td valign="top" align="left">
      Answer option text 1
   </td>
</tr>

Example 2:
I want to show a single grid question label Q1 in another question, I need to make sure the HTML contains the following code for each answer option and each sub question. Q1 has 2 answer options

<tr>
   <td width="16px" valign="top" align="center">
      <input type="radio" value="1" name="QUESTION.Q1.0">
   </td>
   <td width="16px" valign="top" align="center">
      <input type="radio" value="2" name="QUESTION.Q1.0">
   </td>

</tr>

There are basically 3 ways of handling this task.

Use HTML

quest.onInit

quest.getHTML