Copy link to clipboard
Copied
Hi,
I downloaded captivate version 9 and I am very much new in using it .
I have some questions,
Question 1:
I would like to know if there is setting in captivate so if user refresh page on particular slide then it needs to start from where it leaves and not from Start. I think thats like saving cookies in captivate? I found one article where it mentioned to try and do "Project > Table of Contents > Check Show TOC" but its not working for me.
Question 2:
While adding Volume Control widget, source is coming not available and in output after publishing, there is not audio controller loading in the slide. Any Idea?
Please let me know on any of both issues.
Thank you
Gulshan
This will get all of the user variables and write them to local storage:
window.onbeforeunload = function( e )
{
var lessonStorage = cp.model.data.project.pN + '.progressData';
if ( typeof( Storage ) !== 'undefined' )
{
var getVars = cp.ReportingVariables;
getVars = getVars.split( ',' );
var myVars = new Object;
for ( var i = 0; i < getVars.length - 1; i++ )
{
myVars[ getVars[ i ] ] = window[ getVars[ i ] ];
}
localStorage.setItem( lessonStorage, JSON.stringify( myVars ) );
}
};
Then to r
...Copy link to clipboard
Copied
You can write cookies and the TOC does write a cookie if you go into the Settings portion of the TOC settings and choose self-paced learning. This will return you to the beginning of the slide.
You will need to set a cookie, better to use localStorage, when the project is closing in the window. You need to add some JavaScript and add an listener to the window for the unload event and set the localStorage to the current Frame.
window.onbeforeunload = function(e) {
var lessonStorage = cp.model.data.project.pN + '.progressData'
if ( typeof( Storage ) !== 'undefined' )
{
localStorage.setItem( lessonStorage, JSON.stringify( window.cpInfoCurrentFrame ) );
}
};
This code will take the name of the project, you must enter one in the Publish Settings/Project/Information Project Name: field and write the current frame to the localStorage before the window closes.
Then you'd need to add the module ready event and when it fires jump to the frame.
window.addEventListener( 'moduleReadyEvent', function ( e )
{
var getResults = localStorage.getItem( lessonStorage );
var getProgress = JSON.parse( getResults );
window.cpCmndGotoFrameAndResume = parseInt(getProgress);
});
I didn't actually test this but if you put it in the head of the index page it should work, might need some tweaking.
Copy link to clipboard
Copied
Hi,
Thanks for replying... javascript works well for me, Thank you very much
but I have some more issues. javascript you given is working but I have slides and then quiz too... when I have 5 question and I already given answers for 2... and if page gets refresh, it comes to correct page but did not save what I have answered for number 1 question. I have to do retest... do you know anything on this?
Copy link to clipboard
Copied
That's getting way more complicated and would take way more time than I have to research it for free.
Is this a SCORM course?
What are you quiz settings as far as:
Optional
Required
Pass Required
Answer All
I would try the Pass Required option.
Copy link to clipboard
Copied
Hi,
Quiz contents some optional, true/false option, multiple choice answer type questions...I can understand it will take time but is there any ready command available?
Copy link to clipboard
Copied
There isn't any ready command available.
I would suggest you choose the "Pass Required" option and see what happens.
Copy link to clipboard
Copied
Ok, I will check.. thank you very much for your help
Copy link to clipboard
Copied
This is wild. I come here today with nearly the exact same question, and find a poster asking it AND Noel is my name. Crazy!
On topic: I have run into a similar situation except that I am only using scenario-based interactive questions. This is not in a SCORM environment. I have a few scenario questions scattered about my lesson where a user must select a right or wrong answer. If they correctly answer a question, I simply assign a value of 1 to that scenario's ID variable.
I need to be able to collect and record these values should the user decide to exit the course before completion, then hopefully call those stored values back into Captivate when that user returns.
There are several variables that I use throughout the course to track what sections a user has completed, so those would need to be tracked as well; but honestly, I can probably troubleshoot that on my own with a decent model to follow. If I can manage to store and call one variable, then I can figure the rest out I think. My search returned this topic and I was excited to see a general sample of JS, so thank you for that!
My question then: is this the right direction to take to store these simple 0/1 values on exit to then call them on reload? If not, could you suggest a better option?
Thank you in advance, and I hope this is not derailing.
- Noel.
Copy link to clipboard
Copied
This will get all of the user variables and write them to local storage:
window.onbeforeunload = function( e )
{
var lessonStorage = cp.model.data.project.pN + '.progressData';
if ( typeof( Storage ) !== 'undefined' )
{
var getVars = cp.ReportingVariables;
getVars = getVars.split( ',' );
var myVars = new Object;
for ( var i = 0; i < getVars.length - 1; i++ )
{
myVars[ getVars[ i ] ] = window[ getVars[ i ] ];
}
localStorage.setItem( lessonStorage, JSON.stringify( myVars ) );
}
};
Then to read them back in:
window.addEventListener( 'moduleReadyEvent', function ( e )
{
var getResults = localStorage.getItem( lessonStorage );
var getProgress = JSON.parse( getResults );
if ( typeof getProgress === 'object' )
{
Object.getOwnPropertyNames( getProgress ).forEach( function( val )
{
console.log( val + ' = ' + getProgress[ val ] );
window[ val ] = getProgress[ val ]
});
}
});
Copy link to clipboard
Copied
TLCMediaDesign:
Thank you so much for your reference. I will play with this this afternoon!!
Much appreciated.
- Noel
Copy link to clipboard
Copied
TLC:
Thanks again for your reference. We had to add a line to the addEventListener function in order to declare the variable lessonStorage for it to work, but seems well now.
var lessonStorage = cp.model.data.project.pN + '.progressData';
I'm curious though. This only seems to work when I have the Self-Paced learning option checked while displaying the ToC within the project. Any ideas why this would be dependent on the ToC? I'm playing around now to see if I can record the user's current slide as another user-defined variable, then modify your script to force the captivate project to jump to that slide number. hopefully I can bypass the ToC altogether.
Hey I'm learning! Err... trying to, at least
Copy link to clipboard
Copied
No idea how that could get disabled. Never had a problem with it.
Copy link to clipboard
Copied
Yeah, I'm an idiot. I disabled the Captivate-side script that was writing the variable used for testing. Found and fixed. Your script does NOT require the ToC to function! We only had to declare var lessonStorage again in the event listener as mentioned earlier.
We are modifying it now to track cpInfoCurrentSlide as well so hopefully I'll be able to do away with the Captivate ToC completely.
I do not know if the OP is resolved, but this thread really helped me, so thanks to all involved.
- Noel