Skip to main content
malik1234
Participating Frequently
December 5, 2017
Answered

Time Limit Questions in Captivate

  • December 5, 2017
  • 1 reply
  • 1192 views

Hi everyone,

               I am pretty sure you will have a solution to my issue that is making me go crazy since this morning. Frustrated is a very light word. Hope you will understand the issue.

I have created a quiz with 10 questions all having a time limit of 10 seconds. the students have to answer within the given time, so if they choose A,B, or C from the given options they need to select it and then click on submit to move forward where they get a feedback depending if they chose correctly.

the issue that i have with this is for example if A is the correct answer and the user selects A and has not clicked on submit and the time runs out, the user gets a prompt that the time is up but, captivate still considers it a correct answer even though it was not submitted in time.

Am I missing something here? Please help me out guys.

Thanks

This topic has been closed for replies.
Correct answer Jeremy Shimmerman

Yes i have unchecked the time limit box. how do you set the timer for each question to move to the next slide then? is it in the javascript? because i would like the question to move to next slide after 10 seconds.


Try deleting your myVar and myTimer variables from captivate if you added them 'manually' because that might interfere with the code.

The javascript works as follows:

The setInterval will execute the myTimer function every 10 seconds (10000 milliseconds)

For example if you want to change the timing to every 25 seconds it would you would be

"var myVar = setInterval(function(){ myTimer() }, 25000);"

The myTimer function executes the following:

alert("Your time ran out");

//launches an alert window

window.cpAPIInterface.next();

//Tells captivate to go to the next slide

clearInterval(myVar)

//Clears the timer so it won't go off.

Try deleting the manually inputted in variables and see if that makes a difference. Also when you launch the project (assuming you are using Chrome) press F12 and go to the console to see if any errors are popping up. 

1 reply

Jeremy Shimmerman
Participating Frequently
December 5, 2017

I tested the problem here and I think that captivate's built in 'Time Limit' feature basically triggers the submit button.  I thought a workaround could be to create your own timer.

On Frame Enter for your first quiz slide execute the following javascript

var myVar = setInterval(function(){ myTimer() }, 10000);

function myTimer() {

window.cpAPIInterface.next();

alert("Your time ran out"); 

clearInterval(myVar)

}

I tested this and it will not record any answers that have not been 'submitted'.  You'll need to turn off the timer so on the following slides you'll have to execute:

clearInterval(myVar)

var myVar = setInterval(function(){ myTimer() }, 10000);

function myTimer() {

window.cpAPIInterface.next();

alert("Your time ran out"); 

clearInterval(myVar)

}

When the quiz is finished you'll also have to turn off the timer with just.

clearInterval(myVar)

Let me know if that works.  

malik1234
malik1234Author
Participating Frequently
December 6, 2017

Hi Jeremy, unfortunately i couldnt get it to work. so what i did i executed the top javascript you provided on the first slide and on every question slide i put the 2nd javascript that you provided. i created two variables myVar and myTimer as well but it still submitted the correct option as submitted when the time ran out.

Jeremy Shimmerman
Participating Frequently
December 6, 2017

Try deleting your myVar and myTimer variables from captivate if you added them 'manually' because that might interfere with the code.

The javascript works as follows:

The setInterval will execute the myTimer function every 10 seconds (10000 milliseconds)

For example if you want to change the timing to every 25 seconds it would you would be

"var myVar = setInterval(function(){ myTimer() }, 25000);"

The myTimer function executes the following:

alert("Your time ran out");

//launches an alert window

window.cpAPIInterface.next();

//Tells captivate to go to the next slide

clearInterval(myVar)

//Clears the timer so it won't go off.

Try deleting the manually inputted in variables and see if that makes a difference. Also when you launch the project (assuming you are using Chrome) press F12 and go to the console to see if any errors are popping up. 


I thought of something else.  You may want to clear the timer if they successfully answer the question.

Under 'Quiz' -> 'Actions' -> 'On Success' change it to execute javascript and put in the following:

clearInterval(myVar);

confirm("You got the right answer");

window.cpAPIInterface.next();

You also need to uncheck the 'Correct' under 'Captions'. 

This way as soon as they click submit, it will clear the timer and prompt them to go to the next question before the timer starts again.