Copy link to clipboard
Copied
In Adobe Captivate I would like to create a custom results page for my quiz that lists only the question numbers of the questions missed.
By creating one user variable per question userAnswer1, userAnswer2, userAnswer3, etc. and each time assigning that user variable to the system variable of cpQuizInfoAnswerChoice I'm able to have enough data to create a list of only the question numbers of the questions missed on the quiz results page.
The problem is when I choose "Submit All" in the quiz settings preferences then my user variables don't get any value placed in them. They end up with empty values. My client wants students to be able to go backward and forward through the quiz changing their answers and then making the submission at the end. The client doesn't want students to submit their answer each question, just one time for all the question at the end. So I choose "Submit All" the in quiz settings preferences, but the problem is my user variables then end up with empty values.
Is it possible in Adobe Captivate to have a custom results page for a quiz, with "Select All" chosen in the quiz settings preferences, that lists only the question numbers of the questions missed?
Thank you for any tips or advice in the right direction.
Copy link to clipboard
Copied
The quizzing system var cpQuizInfoAnswerChoice is not populated when you use the feature Submit All. I'm sorry, cannot offer you more help, that feature is restricting so much and the design of quiz slides has many strict rules. Since all answers are submitted at once when the button Submit all is clicked, none of the other reused quizzing system vars will not be of any help neither. In this case, I would choose to create custom question slides, unless some JS guru can give you another solution.
Copy link to clipboard
Copied
You will need to execute this JavaScript externally for it to work. You can put this script in the head of the index.html and when you want the answers, execute JavaScript; getAnswers();
Create a variable in Captivate to display the incorrect answers ( incorrectAnswers )
var incorrectArray = [ ];
function getAnswers()
{
for ( var i = 0; i < cp.movie.questionObjs.length; i++ )
{
if ( cp.movie.questionObjs[ i ].wasJudged )
{
if ( cp.movie.questionObjs[ i ].m_questionScore.m_answeredCorrectly != true )
{
incorrectArray.push( i + 1 );
}
}
}
window.incorrectAnswers = incorrectArray.toString();
}
Copy link to clipboard
Copied
Thank you!, I'm going to try this out today.
Copy link to clipboard
Copied
This is going to return a string that looks like:
1,4,5,7,12
Copy link to clipboard
Copied
Hello TLCMediaDesign,
I tried your solution, it looks easy enough to implement but I have not be able to get it to work.
Here is my head in index.html:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script src="standard.js" type="text/javascript">
var incorrectArray = [ ];
function getAnswers()
{
for ( var i = 0; i < cp.movie.questionObjs.length; i++ )
{
if ( cp.movie.questionObjs[ i ].wasJudged )
{
if ( cp.movie.questionObjs[ i ].m_questionScore.m_answeredCorrectly != true )
{
incorrectArray.push( i + 1 );
}
}
}
window.incorrectAnswers = incorrectArray.toString();
}
</script>
</head>
I created a user variable in Captivate called incorrectAnswers.
On a Captivate slide I have this 'You missed the following questions: $$incorrectAnswers$$' in a textbox.
I’m not sure how to execute the Javascript so in the Script_Window of Captivate I have tried this:
getAnswers();
Which I thought would execute the JavaScript function in the head tag.
Also I tired this in the Script_Window of Captivate:
var incorrectArray = [ ];
for ( var i = 0; i < cp.movie.questionObjs.length; i++ )
{
if ( cp.movie.questionObjs[ i ].wasJudged )
{
if ( cp.movie.questionObjs[ i ].m_questionScore.m_answeredCorrectly != true )
{
incorrectArray.push( i + 1 );
}
}
}
window.incorrectAnswers = incorrectArray.toString();
Which I thought would execute JavaScript in Captivate. I’ve tried these both On Enter and On Exit in different slides before, during and after the quiz result slide. Still I have not been able to get a list of questions missed shown on the screen.
Can you point me in the right direction? Is it possible for you to provide a zip file of a working example? This has been difficult for me. Thank you so much.
Copy link to clipboard
Copied
This will not work for SWF, only HTML5.
I think it's possible for SWF, I'd need to check the event listener, but too busy to set up a test project right now.
Copy link to clipboard
Copied
I'm unable to get this to work.
Seems straightforward. I have tried the solution but can't get it to work. I have gone back and tried it many diffrent ways. Nothing has worked so far.
Copy link to clipboard
Copied
Are you using HTML5?
To make this work for SWF and HTML5 it will need different code.
If this is for HTML5, I would need to see your published index.html contents.
Copy link to clipboard
Copied
I've been trying to make this happen anyway possible. I've been trying with HTML5 and SWF. My preference would be SWF.
This is my index.html:
<!-- Copyright [2008] Adobe Systems Incorporated. All rights reserved -->
<!-- saved from url=(0013)about:internet -->
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script src="standard.js" type="text/javascript"></script>
<!-- ************* -->
<!-- This is the code you gave me -->
<script type="text/javascript">
var incorrectArray = [ ];
function getAnswers()
{
for ( var i = 0; i < cp.movie.questionObjs.length; i++ )
{
if ( cp.movie.questionObjs[ i ].wasJudged )
{
if ( cp.movie.questionObjs[ i ].m_questionScore.m_answeredCorrectly != true )
{
incorrectArray.push( i + 1 );
}
}
}
window.incorrectAnswers = incorrectArray.toString();
}
</script>
<!-- ************* -->
<!-- ************* -->
</head>
<link rel="stylesheet" type="text/css" href="captivate.css" />
<body bgcolor="#ffffff">
<!-- ************* -->
<!-- this probably isn't needed but I've placed it in as I go through trying everything -->
<button onclick="getAnswers()">Click me</button>
<!-- ************* -->
<!-- ************* -->
<div id="CaptivateContent">
</div>
<script type="text/javascript">
var strURLFull = window.document.location.toString();
var intTemp = strURLFull.indexOf("?");
var strURLParams = "";
if(intTemp != -1)
{
strURLParams = strURLFull.substring(intTemp + 1, strURLFull.length);
}
var so = new SWFObject("backForward.swf", "Captivate", "100%", "100%", "11.0", "#CCCCCC");
so.addParam("quality", "high");
so.addParam("name", "Captivate");
so.addParam("id", "Captivate");
so.addParam("wmode", "window");
so.addParam("bgcolor","#ffffff");
so.addParam("seamlesstabbing","true");
so.addParam("menu", "false");
so.addParam("AllowScriptAccess","always");
so.addVariable("variable1", "value1");
if(strURLParams != "")
{
so.addVariable("flashvars",strURLParams);
}
so.setAttribute("redirectUrl", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash");
so.write("CaptivateContent");
</script>
<script type="text/javascript">
document.getElementById('Captivate').focus();
document.Captivate.focus();
</script>
</body>
</html>
Copy link to clipboard
Copied
As I said earlier, this script will NOT work with swf.
I'll try to come up with a script that will work for both later.
In my test this works perfectly for HTML5.
Copy link to clipboard
Copied
Thank you TLCMediaDesign,
I appreciate all the help you have given me, I'm not sure why my above script doesn't work.
Yes, thank you, an example script that works for SWF would be awesome.
--Travis Rex Brian
Copy link to clipboard
Copied
It doesn't work because none of the variables exist in a SWF project, Only HTML5.
Copy link to clipboard
Copied
I am writing one of the scripts that will work for swf or html5.
Do you want the list to show just a list of the question number? or the slide the missed question is on?
Copy link to clipboard
Copied
Try this one:
var interfaceObj, eventEmitterObj, setAnswers = [ ], storeAnswers = [ ], slideArray = [ ];
window.addEventListener( 'moduleReadyEvent', function ( e )
{
interfaceObj = e.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
var numSlides = window.cpAPIInterface.getVariableValue("cpInfoSlideCount");
for ( var i = 0; i < numSlides; i++ )
{
storeAnswers[ i ] = 0;
slideArray[ i ] = 0;
}
initializeEventListeners();
});
function initializeEventListeners()
{
if ( interfaceObj )
{
if ( eventEmitterObj )
{
eventEmitterObj.addEventListener( 'CPAPI_QUESTIONSUBMIT', qSubmit, false );
eventEmitterObj.addEventListener( 'CPAPI_SLIDEENTER', function ( e )
{
if ( e.Data.st == "Question Slide" )
{
slideArray[ Number( e.Data.slideNumber ) - 1 ] = 'q';
}
});
}
}
}
function qSubmit( e )
{
setAnswers = [ ];
var tick = 0;
if ( e.Data.questionAnsweredCorrectly == false )
{
storeAnswers[ window.cpAPIInterface.getVariableValue( 'cpInfoCurrentSlide' ) - 1 ] = 'f';
}
else
{
storeAnswers[ window.cpAPIInterface.getVariableValue( 'cpInfoCurrentSlide' ) - 1 ] = 'p';
}
for ( var i = 0; i < slideArray.length; i++ )
{
if ( slideArray[ i ] == 'q' )
{
tick++;
if ( storeAnswers[ i ] == 'f' )
{
setAnswers.push( tick );
}
}
}
window.cpAPIInterface.setVariableValue( 'incorrectAnswers', setAnswers );
}