Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Submit MY quiz score to the LMS, not the "native quiz" results

Participant ,
May 15, 2015 May 15, 2015

I have gotten better at Advanced Actions in Cap, and as a result... I wish to submit my custom quiz results to the LMS and not the Captivate "quiz slide" method.

I realize i need JavaScript to communicate with the LMS... but how do i set "my_result" to the Captivate quiz score submission?

Thanks!!

~ Sean

3.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , May 19, 2015 May 19, 2015

They definitely are read only if you try to set them from within Captivate. Not so sure if everything is exposed in JavaScript. Don't really have time right now to test all of that. Getting to your script, try this:

Put this function in the head of the HTML page.

function submit_score()

{

var cp = document.Captivate;

var sendScore = cp.cpEIGetValue("m_VarHandle.quiz_score");

SCORM_SetValue("cmi.core.score.raw", Number(sendScore));

SCORM_SetValue('cmi.core.lesson_status', 'passed');

SCORM_Finish('EXIT_TY

...
Translate
LEGEND ,
May 16, 2015 May 16, 2015

The only results that ar transferred to a LMS are the ones in the quizzing system variables. And those variables are read-only, you cannot control/change them.

If you explained more in detail how the 'my_result' variable is getting its value, maybe I could offer some suggestions. Here are two older articles, where you'll find some information about reporting the results of custom questions. I think you are pointing to that kind of questions, my apologies if it is not the case.

Report Custom Questions - part 1 - Captivate blog

Report Custom Questions - part 2 - Captivate blog

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 18, 2015 May 18, 2015

I have a basic practice quiz setup, using SCORM 1.2.

== Description ============================================

10 questions

10 slides + a results slide

Advanced Action validates a drop-down widget choice

If widget = correct {

quiz score is incremented from it's initial value of "0"

}

I then divide total questions / correct answers to get a score, which i called "my_result".

...which i would then like to submit to the LMS in place of Captivate's native quizzing.. if possible that is.   🙂

========================================================

== Question ============================================


Your comment above said the native quiz values are read-only.

Any chance we could get around the read-only-ness via JavaScript?

========================================================

Thank you for your thoughts!

~ Sean

One of the advanced actions in Cap -->>

5-18-2015 7-51-53 AM.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 18, 2015 May 18, 2015

You can try using the JavaScript depending on when Captivate actually writes the score. Your may get overridden unless you hijack the function that writes the score.

JavaScript Window:

var cp = document.Captivate;

var sendScore = cp.cpEIGetValue("m_VarHandle.my_result");

SCORM_SetValue("cmi.core.score.raw", sendScore);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 19, 2015 May 19, 2015

Hello TLC,


I have the following JavaScript executed to exit the course and submit the quiz values to the LMS.


The "rdcmndExit = 1" does not fire, presumably because there is an error in the included JavaScript.


Thoughts?


===============================================================


function submit_score()

{

var objCP = document.Captivate;

var sendScore = objCP.cpEIGetValue("m_VarHandle.quiz_score");

objCP.cpEISetValue("cpQuizInfoPointsscored", sendScore);

SCORM_objAPI.LMSSetValue('cmi.core.score.max', 100);

SCORM_objAPI.LMSSetValue('cmi.core.score.raw', sendScore);

SCORM_objAPI.LMSSetValue('cmi.core.lesson_status', 'passed');

SCORM_objAPI.LMSCommit('');

SCORM_objAPI.LMSFinish('');

objCP.cpEISetValue('rdcmndExit', 1);

}

submit_score();

===============================================================

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 19, 2015 May 19, 2015

What version of Captivate are you using? I'm wondering where you got the "SCORM_objAPI."?

Also, you don't need the rdcmndExit, the LMSFinish should close the course.

Also you cannot set cpQuizInfoPointsscored as it's read only.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 19, 2015 May 19, 2015

System:

Captivate 8 x64

Windows 7 x64

SCORM 1.2

I "thought" SCORM_objAPI was the correct API to call the cmi.core features.

So cpQuizInfoPointsscored is readonly

and cpQuizInfoTotalPointsscored is read only too?

That sounds an awful lot like "what you want isn't possible."

But that's just my thoughts... Thank you for yours!

~ Sean

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 19, 2015 May 19, 2015

They definitely are read only if you try to set them from within Captivate. Not so sure if everything is exposed in JavaScript. Don't really have time right now to test all of that. Getting to your script, try this:

Put this function in the head of the HTML page.

function submit_score()

{

var cp = document.Captivate;

var sendScore = cp.cpEIGetValue("m_VarHandle.quiz_score");

SCORM_SetValue("cmi.core.score.raw", Number(sendScore));

SCORM_SetValue('cmi.core.lesson_status', 'passed');

SCORM_Finish('EXIT_TYPE_FINISH', 'true');

}

On you last page, click a button and execute the JavaScript

submit_score();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 21, 2015 May 21, 2015

The above JavaScript did not trigger any activity once added to the HTML file and triggered by a button w/ JavaScript.

I have seen several different ways in which to reference a Captivate quizzing item.

Most documentation i've seen has the LMSSetValue call, but i'm not sure what the API prefix is for my system.

=================================================================

var cp = document.Captivate;

var sendScore = cp.cpEIGetValue("m_VarHandle.quiz_score");

SCORM_objAPI.LMSSetValue('cmi.core.score.max', 100);

SCORM_objAPI.LMSSetValue('cmi.core.score.raw', sendScore);

SCORM_objAPI.LMSSetValue('cmi.core.lesson_status', 'passed');

SCORM_objAPI.LMSCommit('');

SCORM_objAPI.LMSFinish('');

== OR ==

var cp = document.Captivate;

var sendScore = cp.cpEIGetValue("m_VarHandle.quiz_score");

SCORM_SetValue("cmi.core.score.raw", Number(sendScore));

SCORM_SetValue('cmi.core.lesson_status', 'passed');

SCORM_Finish('EXIT_TYPE_FINISH', 'true');

=================================================================

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 21, 2015 May 21, 2015

Are you using SWF or HTML5 or both?

Once your file is running in an LMS you don't need the API prefix with the Captivate scormdiver.js.

I think I was looking at a different file, it's SCORM_CallLMSSetValue. I'll throw one together this weekend and see how to overwrite the score.

var cp = document.Captivate;

var sendScore = cp.cpEIGetValue("m_VarHandle.quiz_score");

SCORM_CallLMSSetValue("cmi.core.score.raw", Number(sendScore));

SCORM_CallLMSSetValue('cmi.core.lesson_status', 'passed');

SCORM_Finish('EXIT_TYPE_FINISH', 'true');

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 25, 2015 May 25, 2015

I did this test for SCORM 1.2 with the settings in the image.

I created a function in the html page:

<script>

        function setScore(myScore)

        {

         SCORM_SetScore(myScore,30,0)

        }

  </script>

Note that there were 3 questions so I kept max score at 30.

In CP I executed the following JS, newScore is the user variable to write to the LMS.:

var cp = document.GetElementById("Captivate");

var getScore = cp.cpEIGetValue('m_VarHandle.' + newScore);

setScore("getScore");

It overwrote the Score.

SetScoreSettings.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 27, 2015 May 27, 2015

Here is the script i am attempting to execute when exiting the course.

The script runs correctly if executed by an action within Captivate.

If the script is triggered from the onunload or unbeforeunload, there is no result.

Thoughts?

==========================================

<script>

    function closeOut()

    {

        var passing_percentage = window.cpAPIInterface.getVariableValue("cpQuizInfoQuizPassPercent");

        var valid = window.cpAPIInterface.getVariableValue("quiz_score");

        if (valid > 0)

        {

            var final_score = window.cpAPIInterface.getVariableValue("quiz_score");

            alert("Your score was " + final_score);

            window.cpAPIInterface.setVariableValue("cpQuizInfoTotalQuizPoints", final_score);

           

            if (final_score >= passing_percentage)

            {

                alert("You passed with a score of " + final_score);

               

                SCORM_CallLMSSetValue("cmi.core.lesson_status","completed");

                SCORM_CallLMSSetValue("cmi.core.exit","logout");

                SCORM_SetScore(final_score,100,0)

                SCORM_CallLMSCommit();

                SCORM_CallLMSFinish();

            }

            else

            {

                alert("You have not passed.");

               

                SCORM_CallLMSSetValue("cmi.core.lesson_status","incomplete");

                SCORM_CallLMSSetValue("cmi.core.exit","logout");

                SCORM_SetScore(final_score,100,0)

                SCORM_CallLMSCommit();

                SCORM_CallLMSFinish();

            }

        }

        else

        {

            alert("This course is incomplete.");

            window.cpAPIInterface.setVariableValue("cpQuizInfoTotalQuizPoints", 0);

            SCORM_SetScore(0,100,0);

            SCORM_CallLMSSetValue("cmi.core.lesson_status","incomplete");

            SCORM_CallLMSSetValue("cmi.core.exit","");

            SCORM_CallLMSCommit();

            SCORM_CallLMSFinish();   

        }

    }

</script>

==========================================

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 03, 2015 Jun 03, 2015

I updated my previous post with my current code to make things easier.

Any thoughts?!


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 03, 2015 Jun 03, 2015

Yes, never rely on the onuload or onbeforeunload when trying to write to the LMS. The LMS usually knows it's happening and terminates the session.

Execute from the onEnter of the last slide or have the users click a button to register the score.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 08, 2015 Jun 08, 2015

I do have a follow-up question:

When native Captivate courses are opened and closed without taking a quiz, they're marked as "incomplete."

When MY course and custom quiz is opened and closed without quizzing, it's marked as "Completed".

Something is different in the way that exit behavior is handled between the two of them... but i'm unsure what.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 08, 2015 Jun 08, 2015

I'm not sure what all of your quiz preferences are, but I think you are trying to manipulate things that Captivate is doing internally.

The best way to do this would be to create your own SCORM wrapper, there are quite a few you can download. Do NOT publish to SCORM and make the SCORM calls yourself so Captivate isn't doing it also.

Captivate will still have the quizzing info, but it won't write to the LMS.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
May 16, 2015 May 16, 2015

Here are some of the SORM values for 2004 and 1.2:

 

SCORM 2004 Score

 

  • Set cmi.score.raw to 8
  • Set cmi.score.min to 0
  • Set cmi.score.max to 10
  • Set cmi.score.scaled to 0.8SCORM 1.2 Score

  

  1. cmi.core.score.raw

Yes

Yes

CMIDecimal/CMIBlank

a normalized value between 0 and 100, initially blank

  1. cmi.core.score.min*

Yes

Yes

CMIDecimal/CMIBlank

a normalized value between 0 and 100, initially blank

  1. cmi.core.score.max*

Yes

Yes

CMIDecimal/CMIBlank

a normalized value between 0 and 100, initially blank

 

 

This may work to set these values if they are not already set. It may also affect the lesson status and success as the roll-up[ rules are different for each SCORM version.

To make the calls, use the following JavaScript examples. 

SCORM2004_SetValue(“cmi.score.scaled”,yourVar)

SCORM_SetValue(“cmi.core.score.raw”,yourVar)

Note that you'll need to get the CP var for whatever version of CP and may have to be in quotes in the script window.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 01, 2017 Feb 01, 2017

We are using xapi rather than scorm.  Will these approaches still work,  or are they scorm specific?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 25, 2017 Feb 25, 2017
LATEST

The following strategy enables creating a custom score without requiring direct SCORM interaction.  It modifies the internal scoring process in Captivate:

https://medium.com/@hdecisions/custom-quiz-scoring-in-adobe-captivate-245b60ef49d3#.apbzqvl8m

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources