Show more than one questions in the same page

From Catglobe Wiki
Revision as of 06:47, 8 March 2010 by Catglobe (talk | contribs) (Solutions)
Jump to: navigation, search

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.

<source lang=html4strict>

     <input type="radio" onclick="optclick('QUESTION.Q1',0,false);" value="1" name="QUESTION.Q1">
     <a href="javascript:optclick('QUESTION.Q1',0,true);" class="option_link">Answer option text 1</a>

<source> 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.
<source lang=HTML>

     <input type="radio" onclick="optclick('QUESTION.Q1.0',0,false);" value="1" name="QUESTION.Q1.0">

<source> There are basically 3 ways of handling this task.

Use HTML

quest.onInit

quest.getHTML