Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Auto refresh answer sheet after time period

From Catglobe Wiki
Revision as of 08:06, 6 July 2017 by Hovietluu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This solution will help you refresh answer sheet after time period.

Here is a way that we can use to make this solution easily:

Preparing JavaScript Code for questionnaire's Java Script.

// IsTestMode : bool
// Parameters: string : eg: &T=1
window.callWF = function(IsTestMode, Parameters){
  if(IsTestMode) document.location = "https://voxmeter.catglobe.com/Login.aspx?r=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&n=2&b=1&Test=1" + Parameters;
  else		 	 document.location = "https://voxmeter.catglobe.com/Login.aspx?r=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&n=2&b=1" + Parameters;
}

Let's copy this code and replace the 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' by your questionnaire GUID. Then paste it into Questionnaire's Java script tab on Questionnaire Template Editor.

What is Questionnaire GUID? Don't worry, I will show you how to get it below.

Please see screenshot:

this screenshot will show you where you paste this script code:

Preparing JavaScript Code for question's Java Script.

Question.bind('afterShowQuestion', function(question, answerSheet, element) {
 var time = 10000; //(milisecond) this is the time period that QAS was created new, it need to be set by manual
 var isTestMode = {{getRPQTest()?2:1;}} == 1;
 var parameter = ""; // we can put our parameter here. eg: &t=1
       
 var timer = setTimeout(function(){callWF(isTestMode,parameter)},time);
 $('.next:eq(0)').click(function(){
         clearTimeout(timer);
 });
});

When you finished with questionnaire java script code, let's continue with question java script code.

There are 2 variables that you must focus:

+ time: this is the time period that then we will refresh questionnaire answer sheet.(milisecond)

+ parameter: it is your parameter which you want to add more on the link of questionainare.

You also set to empty as default on above code.

When you completely finish the step preparing code for question java script, you must paste that code into the question which you use this solution.

Testing.

End of Documentation.