Jump to content
Toggle menu
  • 915 articles
  • 3.8K files
  • 30.2K users
  • 279.2K edits
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Hide Next button in n seconds: Difference between revisions

From Catglobe Wiki
No edit summary
Line 1: Line 1:
== ChallengeĀ  ==
== ChallengeĀ  ==


In order to not allow respondent click on the Next button in a period of t<br>As a questionnaire creator<br>I want to hide the Next button in some seconds&nbsp; Ā 
In order to not allow respondent click on the Next button in a period of time<br>As a questionnaire creator<br>I want to hide the Next button in some seconds&nbsp;


== SolutionĀ  ==
== SolutionĀ  ==

Revision as of 06:22, 12 February 2009

Challenge

In order to not allow respondent click on the Next button in a period of time
As a questionnaire creator
I want to hide the Next button in some secondsĀ 

Solution

  • In questionnaire template editor, choose theĀ questionĀ I want to hide the Next button,Ā and thenĀ go to the Properties - Edit question properties - Language dependent - Select javascript propertyĀ 
  • Create a onInit() function.
  • In that function, check if the Next button existed.Ā 
  • If it doesn't exist, do nothing, else disable the Next button, set the timeĀ out to number of secondsĀ I want to hide theĀ button, then show the button again.Ā Ā 

Code

quest.onInit = function()
{
var secsTimeout = 10;Ā 

if ( !document.getElementsByName('next') || document.getElementsByName('next').length == 0 )
{
// next button not available
return;
}
else
{
document.getElementsByName('next')[0].style.display='none';
}

var timeout = setTimeout("document.getElementsByName('next')[0].style.display=;", secsTimeout*1000);

}