Problems getting SCORM 2004 to do what it's supposed to

1.4k views Asked by At

Thanks for reading and I hope you can give me a hand with this.

I don't have much experience with SCORM; until now I had always worked in SCORM 1.2 but I have been asked to deliver a project in SCORM 2004. This is for a course which has been built in HTML5 directly in Dreamweaver and I've linked the JS as external files.

WHAT IS SUPPOSED TO HAPPEN: 1) Supposedly I'm storing the lesson location so that when you exit a lesson and open it again, you start off on the page where you left it. Unfortunately, it always starts again from the first page. 2) Supposedly the lesson should not be marking itself as "completed" until you reach the last page of the lesson, but unfortunately it marks itself as "completed" as soon as you've started the lesson.

Following are samples of my code, starting with three HTML samples (first page of the lesson, intermediate pages of the lesson and final page of the lesson), and then the two JS files with my SCORM functions.

1) HTML: first page of the lesson.

<script type="text/javascript" language="javascript" name="mm_scormRTI" src="SCOfunctions.js"></script>
<script language="javascript">
    var currentScoPage = scoPage[ i ] ;
    SetValue("cmi.location", currentScoPage ); 
    Terminate(); // close out this SCO, we are finished
</script>
<script language="javascript">
    Initialize(); // initialize the SCO with the LMS
    var currentScoPage = GetValue("cmi.location");
    if (currentScoPage != "") {
        self.location = currentScoPage;
    }else{
        currentScoPage = scoPage[0];
    }
</script>
</head>
<body onLoad="mm_adlOnload()">
...

2) HTML: intermediate pages of the lesson

<script type="text/javascript" language="javascript" name="mm_scormRTI" src="SCOfunctions.js"></script>
<script language="javascript">
    var currentScoPage = scoPage[ i ] ;
    SetValue("cmi.location", currentScoPage ); 
    Terminate(); // close out this SCO, we are finished
</script>
</head>
<body onLoad="mm_adlOnload()">
...

3) HTML: final page of the lesson

<script type="text/javascript" language="javascript" name="mm_scormRTI" src="SCOcomplete.js"></script>
<script language="javascript">
    var currentScoPage = scoPage[ i ] ;
    SetValue("cmi.location", currentScoPage ); 
    Terminate(); // close out this SCO, we are finished
</script>
</head>
<body onLoad="mm_adlOnload()" onUnload="mm_adlOnunload()">
...

4) SCORM: external file "SCOfunctions.js"

function mm_adlOnload()
{
  if (mm_adl_API != null)
  {
    mm_adl_API.Initialize("");
    mm_adl_API.SetValue("cmi.completion_status", "incomplete");
  }
}
function mm_adlOnunload()
{
  if (mm_adl_API != null)
  {
    mm_adl_API.SetValue("cmi.completion_status", "incomplete");
    mm_adl_API.Commit("");
  }
}
GetAPI(window);

var nFindAPITries = 0;
var API = null;
var maxTries = 500;

function ScanForAPI(win)
{
   while ((win.API_1484_11 == null) && (win.parent != null) && (win.parent != win))
   {
      nFindAPITries++;
      if (nFindAPITries > maxTries)
      {
         return null;
      }
      win = win.parent;
   }
   return win.API_1484_11;
}

function GetAPI(win)
{
   if ((win.parent != null) && (win.parent != win))
   {
      API = ScanForAPI(win.parent);
   }
   if ((API == null) && (win.opener != null))
   {
      API = ScanForAPI(win.opener);
   }
}

5) SCORM: external file "SCOcomplete.js"

var nFindAPITries = 0;
var API = null;
var maxTries = 500;

function ScanForAPI(win)
{
   while ((win.API_1484_11 == null) && (win.parent != null) && (win.parent != win))
   {
      nFindAPITries++;
      if (nFindAPITries > maxTries)
      {
         return null;
      }
      win = win.parent;
   }
   return win.API_1484_11;
}

function GetAPI(win)
{
   if ((win.parent != null) && (win.parent != win))
   {
      API = ScanForAPI(win.parent);
   }
   if ((API == null) && (win.opener != null))
   {
      API = ScanForAPI(win.opener);
   }
}
function mm_adlOnload()
{
  if (mm_adl_API != null)
  {
    mm_adl_API.SetValue("cmi.completion_status", "incomplete");
  }
}
function mm_adlOnunload()
{
  if (mm_adl_API != null)
  {
    mm_adl_API.SetValue("cmi.completion_status", "completed");
    mm_adl_API.Commit("");
    mm_adl_API.Terminate("");
  }
}
GetAPI();

What am I doing wrong? If anybody at least has a working example of a similar SCORM 2004 project or can see what I might be doing wrong, it would be greatly appreciated.

Many, many thanks in advance!

2

There are 2 answers

2
pipwerks On

You're calling Terminate() immediately after SetValue(). You must invoke Commit() after SetValue() to persist (save) the data in the database. Otherwise you're exiting the SCO without having saved anything.

Also, have you checked to ensure the value of scoPage[i] is accurate?

0
Mark On

Building off your example couple others things.

  1. I don't see a ("cmi.exit", "suspend") set. If you don't set that up right, the LMS will commonly re-launch a new attempt (clean).
  2. Single Page SCOs vs Multi page SCOs typically contained within a IFRAME/Frameset or AJAX load setting 'cmi.location' may not result in the behavior your trying to achieve.

So if you have a lesson/unit/chapter (imsmanifest.xml) made up of individual pages as each page they view you'll want to auto-score them or base it on something they are interacting with.

  • cmi.location '2' (or whatever page your on) - only if your in a multipage SCO
  • cmi.success_status "passed" or "failed"
  • cmi.completion_status "completed" or "incomplete"
  • cmi.session_time - requires a ISO8601 duration
  • cmi.score.scaled 1 or 0 (min, max, raw if you want too)
  • cmi.exit ('normal' or 'suspend')
  • commit()
  • terminate()

    • cmi.total_time - managed by the LMS (they add last session time + current session time)

All depends on your single vs multi page. If single page you'll exit normal, no bookmark needed. The LMS will mark each item in the TOC completed/scored as you progress.

Good Luck