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

From Catglobe Wiki
Jump to: navigation, search
(Solutions)
(Solutions)
Line 23: Line 23:
 
</tr>
 
</tr>
  
<source>
+
</source>
  
 
Example 2:<br/>
 
Example 2:<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.<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.<br/>
<source lang=HTML>
+
<source lang=html4strict>
 
<tr>
 
<tr>
 
   <td width="16px" valign="top" align="center">
 
   <td width="16px" valign="top" align="center">
Line 34: Line 34:
 
</tr>
 
</tr>
  
<source>
+
</source>
  
 
There are basically 3 ways of handling this task.
 
There are basically 3 ways of handling this task.

Revision as of 06:47, 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" onclick="optclick('QUESTION.Q1',0,false);" value="1" name="QUESTION.Q1">
   </td>
   <td valign="top" align="left">
      <a href="javascript:optclick('QUESTION.Q1',0,true);" class="option_link">Answer option text 1</a>
   </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.

<tr>
   <td width="16px" valign="top" align="center">
      <input type="radio" onclick="optclick('QUESTION.Q1.0',0,false);" value="1" name="QUESTION.Q1.0">
   </td>
</tr>

There are basically 3 ways of handling this task.

Use HTML

quest.onInit

quest.getHTML