Skip to main content
Participant
July 24, 2015
Question

Javascript Print Code won't work on LMS/SCORM

  • July 24, 2015
  • 2 replies
  • 537 views

Hi,

I'm trying to figure out why this javascript, will work on my web server when published without SCORM...but when published with SCORM 2004 and 1.2 the code doesn't work.

Script

var header = "Title of the Slide~~"

var args =(

"Question 1~~" +

cp.vm.getVariableValue('Text_Entry_Box_1')+

"~~Question 2~~" +

cp.vm.getVariableValue('Text_Entry_Box_2')+

"~~Question 3~~" +

cp.vm.getVariableValue('Text_Entry_Box_3')

)

var url = ("print.html?=" + header + args);

window.open(url,"_blank","width=800,height=600,menubar=no");

It's associate with a print button...

This is the SCORM version; SCORM Cloud

Here is a normal web version (that works); http://lcdprodesigns.com/printResults_test/index.html

There are two files that I have to add to the SCORM zip, logo.png and print.html. I have also been adding them to the imsmanifest.xml.

I also tried just SWF and no HTML5, same results of the...print button does nothing.

Thanks,
Rob

    This topic has been closed for replies.

    2 replies

    Participant
    July 24, 2015

    Got it...just took some digging. Thank you RodWard...you pointed me in the right direction!

    New code:

    var header = "Title of the Slide~~"

    var args =(

    "Question 1~~" +

    window.cpAPIInterface.

    getVariableValue('Text_Entry_Box_1')+

    "~~Question 2~~" +

    window.cpAPIInterface.

    getVariableValue('Text_Entry_Box_2')+

    "~~Question 3~~" +

    window.cpAPIInterface.

    getVariableValue('Text_Entry_Box_3')

    )

    var url = ("print.html?=" + header + args);

    window.open(url,"_blank","width=800,height=600,menubar=no");

    RodWard
    Community Expert
    Community Expert
    July 24, 2015

    Is your code allowing for the fact that the SCORM version will be playing from within a frameset that the LMS uses to listen for the SCORM API calls?

    Participant
    July 24, 2015

    I'm guessing not, but I also suck as javascript...I've a designer not a developer. Any tips on how I can update/fix the code?

    Thanks,

    Rob