Difference between revisions of "Number grid"

From Catglobe Wiki
Jump to: navigation, search
(Code)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
-Challenge
+
== Turn a text grid question into a number grid ==
User want to turn a text grid question into a number grid  
 
  
-You can use question property instead of using java script.
+
In order to use a number grid question
<br>
+
 
[[Image:NumberGrid_property.JPG]]  
+
As a questionnaire creator
<br>
+
 
-Code
+
I want to turn a text grid question into a number grid
var maxSQ = quest.questions.length;
+
 
 +
=== Solution ===
 +
 
 +
*Add a Text grid question to Questionnaire editor like below
 +
*You can use question property instead of using java script. <br>  
 +
 
 +
[[Image:NumberGrid.JPG]]  
 +
 
 +
*Go to menu Properties -> Question scripts -> Java script tab -> Input script
 +
 
 +
=== Code ===
 +
 
 +
<source lang="javascript">
 +
var maxSQ = quest.questions.length;  
 +
 
 +
for(var i = 0; i < maxSQ; i++)
  
for(var i = 0; i maxSQ; i++)
 
 
   quest.questions[i].answertype = 2;
 
   quest.questions[i].answertype = 2;
 +
</source>
 +
 +
=== Source ===
 +
 +
Questionnaire Resource Id on cg site: 159730

Latest revision as of 06:03, 11 January 2012

Turn a text grid question into a number grid

In order to use a number grid question

As a questionnaire creator

I want to turn a text grid question into a number grid

Solution

  • Add a Text grid question to Questionnaire editor like below
  • You can use question property instead of using java script.

NumberGrid.JPG

  • Go to menu Properties -> Question scripts -> Java script tab -> Input script

Code

var maxSQ = quest.questions.length; 

for(var i = 0; i < maxSQ; i++) 

  quest.questions[i].answertype = 2;

Source

Questionnaire Resource Id on cg site: 159730