scorm2004 - Should I set cmi.objectives.n.id via Javascript scorm API? -
should set cmi.objectives.0.id before set up, example, cmi.objectives.0.competition_status?
it's in order interpret req_72.4.3.5: "since cmi.objectives.n.id required to set first prior other objective information, if sco attempts set..."
e.g.:
scorm.setvalue('cmi.objectives.0.id', 'obj1'); //? scorm.setvalue('cmi.objectives.0.completion_status', 'completed');
(updated)
sorry, reason thought discussing interactions, not objectives. answer has been modified address objectives.
yes, objective required have id. can set id via javascript api (scorm rte) or via manifest. id must set before can perform other actions on objective, such set completion_status.
if sco requesting store objective information, sco required set identifier first (unless initialized means), prior other objective information. once cmi.objectives.n.id has value, data model element not allowed reset different value.
if aren't sure if id set, can use javascript see if objective exists , if has been assigned id.
example:
var obj_count = parseint(scorm.getvalue('cmi.objectives._count'), 10); if(obj_count === 0){ //we know sure no objectives exist in sco yet. //try setting id scorm.setvalue('cmi.objectives.0.id', 'obj1'); } var id = scorm.getvalue('cmi.objectives.0.id'); var err = parseint(scorm.getlasterror(), 10); if(err == 0 && id == "obj1"){ //continue planned... } else { //there error or id undefined. time troubleshoot. }
if id set still can't set completion_status
, might need double-check manifest:
if
<imsss:objectives>
defined<imscp:item>
element in content package manifest, lms responsible initializing objective run-time data (cmi.objectives.n.xxx) sco based on objective progress information referenced , managed learning activity. run-time data related objectives (cmi.objectives.n.xxx) should not initialized activity’s associated sco unless objective id attribute defined in sequencing information (<imsss:primaryobjective>
or<imsss:objective>
). objective id attribute shall used initialize cmi.objectives.n.id value. number of objectives defined in manifest dictates number of objective status information need initialized.