Difference between revisions of "Count down with invisible counter"

From Catglobe Wiki
Jump to: navigation, search
(New page: == Challenge == You want to use automatically change question, but don't want to show the counter for the respondent. The Next button is often hided when this script is used. == Code == <...)
 
 
Line 1: Line 1:
== Challenge ==
+
== Count down with invisible counter  ==
You want to use automatically change question, but don't want to show the counter for the respondent. The Next button is often hided when this script is used.
 
  
== Code ==
+
In order to change question without clicking Next button.
<source lang="javascript" line="1">
+
 
 +
As a questionnaire creator
 +
 
 +
I want to use automatically change question, but don't want to show the counter for the respondent
 +
 
 +
'''Example '''
 +
 
 +
*I have a Text grid question like below.
 +
 
 +
[[Image:CountDownWithInvisibleCounter.png]]
 +
 
 +
*I want to change question without clicking Next button.
 +
 
 +
=== Solution  ===
 +
 
 +
*Add a Single question to Questionnaire editor like below
 +
*Go to menu Properties -&gt; Question scripts -&gt; Java script tab -&gt; Input script
 +
 
 +
[[Image:CountDownWithInvisibleCounter Code.png]]
 +
 
 +
=== Code  ===
 +
 
 +
<source lang="javascript">
 
function jumpon()       
 
function jumpon()       
 
{
 
{
Line 12: Line 33:
 
//defines how many milliseconds the question should be visible for the respondent
 
//defines how many milliseconds the question should be visible for the respondent
 
window.setTimeout("jumpon();", 1500);
 
window.setTimeout("jumpon();", 1500);
</source>
+
</source>  
 +
 
 +
=== Source  ===
 +
 
 +
Questionnaire Resource Id on cg site: 159730

Latest revision as of 10:40, 11 January 2012

Count down with invisible counter

In order to change question without clicking Next button.

As a questionnaire creator

I want to use automatically change question, but don't want to show the counter for the respondent

Example

  • I have a Text grid question like below.

CountDownWithInvisibleCounter.png

  • I want to change question without clicking Next button.

Solution

  • Add a Single question to Questionnaire editor like below
  • Go to menu Properties -> Question scripts -> Java script tab -> Input script

CountDownWithInvisibleCounter Code.png

Code

function jumpon()      
{
     document["query"]["dir"].value = "next";
     document["query"].submit();
}

//defines how many milliseconds the question should be visible for the respondent
window.setTimeout("jumpon();", 1500);

Source

Questionnaire Resource Id on cg site: 159730