Logging student answer in LMS, bit of tweaking

I write contents for a propietary LMS and it happens that the tutor is offered the interaction id and student__response fields when checking the learner’s map. It would be great that being meaningfull for the tutor.
Just did it, and this is my solution:

  • At field.transf, change the sm:WInputText for a W:InputTextArea. The answers are not expected to be so short. Also, the solution is not shown, ever.

  • Still at field.transf, insert a sm:postProcessing sm:jsEval tag in sm:scoreComputing, like this: try{myObj.myFunc(this)}catch(e){};

  • Then, at skin.js fill in myFunc() body:

    myObj = {
    myFunc: function (item){
    var cod = item.fId;
    var resp = sc$(cod+"_form")[0].value;
    var preg = sc$(cod+"_N_question").innerText;
    var capi ;
    if (scServices.scorm12 && scServices.scorm12.isScorm12Active()) {
    capi = scServices.scorm12.getScorm12API();
    var myGetValue = capi.LMSGetValue;
    var mySetValue = capi.LMSSetValue;
    } else if (scServices.scorm2k4 && scServices.scorm2k4.isScorm2k4Active()) {
    capi = scServices.scorm2k4.getScorm2k4API();
    var myGetValue = capi.GetValue;
    var mySetValue = capi.SetValue;
    } else {
    return null;
    }
    try{
    var nint = myGetValue.call(capi,“cmi.interactions._count”);
    } catch (e) {
    var nint = 0;
    }
    var i = 0;
    for (i=0; i++; i < nint) {
    key = myGetValue.call(capi,“cmi.interactions.”+i+".id");
    if (!key.localeCompare(preg)) break;
    }
    mySetValue.call(capi,“cmi.interactions.”+i+".id",preg);
    mySetValue.call(capi,“cmi.interactions.”+i+".student_response",resp);
    }
    }

And that do the job.

Thanks a lot for your work and efforts. It’s been really funny.

I tried the solution in a production environment and it worked if there’s only one short answer interaction. I forgot to tell you that the LMS is scorm12, and the content is a monoscorm lesson. My mistake.

It seems you need to pass in the scServices variable when you make the call, and use it in the skin.js function. After that (and a few bugs and typos), it is working fine.