Copy link to clipboard
Copied
Hi folks,
A long, long time ago, way back in Captivate 5.5, I managed to "save" some data in a SCORM 1.2 course as part of a convoluted randomization thingy (https://forums.adobe.com/thread/1176710). I wrote the data to cmi.comments using this little snippet:
g_objAPI.LMSSetValue('cmi.comments', 'whateverDataHere');
I'd like to do something similar again in Captivate 8 (not the whole convoluted randomization thingy-- I just want to save some data to comments so it'll be easily readable by someone who looks at the SCORM data). I'm assuming that things have changed since then. I've tried googling, but the closest I can find is the general JavaScript tutorial for Captivate 8, and that seems to be about interacting with Captivate, not SCORM.
Any hints/suggestions? I feel like this should be relatively simple, but without the proper "wording," I'm stuck. (It's also been a while since I dabbled in JavaScript, so that might be hindering me, too )
Thanks!
1 Correct answer
You'll want to use something like this for SCORM 1.2 content:
SCORM_CallLMSSetValue('cmi.comments', 'Hello');
For SCORM 2004, you can use the cmi.comments_from_learner collection (an array):
SCORM2004_CallSetValue('cmi.comments_from_learner.0.comment', 'Hello');
see section 4.2.2 of the SCORM 2004 Run-Time Environment manual for more details.
Jim Leichliter
Copy link to clipboard
Copied
You'll want to use something like this for SCORM 1.2 content:
SCORM_CallLMSSetValue('cmi.comments', 'Hello');
For SCORM 2004, you can use the cmi.comments_from_learner collection (an array):
SCORM2004_CallSetValue('cmi.comments_from_learner.0.comment', 'Hello');
see section 4.2.2 of the SCORM 2004 Run-Time Environment manual for more details.
Jim Leichliter
Copy link to clipboard
Copied
Thank you! (I was hoping you'd see this, and I really appreciate your quick and concise reply-- regulars like you and Lieve are awesome )
It's working perfectly for me in SCORM Cloud (as well as SCORM_CallLMSGetValue which I tried on a whim). Now it just needs testing on our LMS, so fingers crossed.
Copy link to clipboard
Copied
I understand this is an old post, but maybe one of you can help me out.
I want to send text that the user would enter in a text entry box to api cmi.comments.
Some people have told me this should automatically happen but I have not been able to get this to work at all.
I used this snippit:
SCORM_CallLMSSetValue('cmi.comments', 'Hello'); and changed hello to box1 (the name of my variable attached to a text entry box)
It looked like this
SCORM_CallLMSSetValue('cmi.comments', 'box1');
I attached the javascript to a button via advanced actions.
In my report from the LMS- cmi.comments returned the value 'box1' - which makes sense based on the javascript.
(At this point I am happy to return anything in cmi.comments because I have tried so many things that haven't worked- This is the first script that returned anything to cmi.comments)
Now, my question is- how do I make it return the text the user has entered in the text entry box instead of the variable name?
ElaKat​
Copy link to clipboard
Copied
When you put quotes around a variable, it's no longer a variable.
If this is html5 use:
SCORM_CallLMSSetValue("cmi.comments", window.box1);
Also you should note that cmi.comments are appended to whatever is there so you may want to use a delimiter so the you can see the last comment clearly.
Copy link to clipboard
Copied
Thank you for your response.
I just tested this- The value I got back in the LMS was 'undefined'.
I found a work around by using short answer quiz questions in Captivate. I am able to report on that using cmi.interactions.student_response (no javascript needed). But I would really like to be able to do this with a TEB as well.
Copy link to clipboard
Copied
You created the variable in Captivate?
Is this HTML5?
Undefined means that the variable wasn't created, not that it wasn't populated.
Copy link to clipboard
Copied
HTML5 was the issue. I published to SWF and HTML5. When I published to HTML5 only, I was able to get the value. Thank you!
Copy link to clipboard
Copied
If you want it to work for both:
SCORM_CallLMSSetValue("cmi.comments",window.cpAPIInterface.getVariableValue("box1"));
Copy link to clipboard
Copied
Awesome. I will try that out.
What if I want to include a / after each, or some way to separate box1 input from box2 input? Right now it includes them all with no space between box1 entry and box2 entry if I have more than one variable value going to cmi.comments.
Copy link to clipboard
Copied
SCORM_CallLMSSetValue("cmi.comments"," / "+window.cpAPIInterface.getVariableValue("box1"));
Copy link to clipboard
Copied
Thank you for your help! You're a lifesaver.
Copy link to clipboard
Copied
Does anyone if you can clear the cmi.comments?
Currently if I were to do:
SCORM_CallLMSSetValue('cmi.comments', 'Hello');
and then
SCORM_CallLMSSetValue('cmi.comments', 'World');
The cmi.comments would read "HelloWorld" and actually I want to be able to clear it out so that I can start from scratch. Any ideas?
Copy link to clipboard
Copied
The concatenation may be due to the behavior of your LMS provider's implementation of SCORM... or the version of SCORM you are using. You can read here for more info.
Copy link to clipboard
Copied
You cannot clear comment in SCORM 1.2. You need to use a special character to separate the comments when writing them, say an "*".
Then you need to turn the comments into an array when reading and get the last comment.
So something like this to read:
var getComments = SCORM_CallLMSGetValue('cmi.comments').split("*");
var myComment = getComments[getComments.length);

