Skip to main content
Known Participant
July 25, 2014
Question

Captivate 7.0.1.237 no longer pulling in variables, HTML5 output, Javascript

  • July 25, 2014
  • 3 replies
  • 2804 views

Hello,

We were originally using Captivate 7.0.0.118. Currently, the program pulls data from a database using inline javascript and the variables are then defined by a querystring. All worked well except for the HTML5 output on Safari browsers. The videos that were included would loop when viewed on these browsers. Adobe had suggested we install the 7.0.1.237 patch. After installing the patch, the video no longer looped on these browsers. However, the data is no longer being pulled into the program.

We put our javascript inline with the index.html. This worked prior to the patch. However, index.html is so different, we may be doing it improperly.index.html puts everything into  document.body.innerHTML . Though our javascript may not be appropriate there either.

Any insights?

Hoping someone might be able to help.

Thanks,

Ruth

    This topic has been closed for replies.

    3 replies

    Legend
    July 30, 2014

    Ruth,

    I see what you're saying.  The document.body.innerHTML overwrites the form element that you're adding to the html page.  So what I'd recommend is adding your form to that document.body.innerHTML as the first element/node.  Here's the full HTML file that I was able to get working on my test site:

    <!DOCTYPE html>

    <html>

    <head>

    <meta name='viewport' content='initial-scale = 1, minimum-scale = 1, maximum-scale = 1'/>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <meta http-equiv="x-ua-compatible" content="IE=10">

    <title></title>

    <style type="text/css">#initialLoading{background:url(assets/htmlimages/loader.gif) no-repeat center center;background-color:#ffffff;position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;z-index:10010;}</style>

    <script>

    function initializeCP()

    {

      function cpInit()

      {

      document.body.innerHTML =  '<div style="display: none; visibility: hidden;"><form id="main" name="main" style="display: none; visibility: hidden;" method="post" action="FLToASPVariable.aspx">' +

      '<input id="inpHide" name="inpHide" type="hidden" />' +

      '<input id="progid" name="progid" type="hidden" />' +

      '<input id="userid" name="userid" type="hidden" />' +

      '<input id="lastmod0" name="lastmod0" type="hidden" />'+

      '<input id="modscore0" name="modscore0" type="hidden" />'+

      '<input id="moddate0" name="moddate0" type="hidden" />' +

      '<input id="compind0" name="compind0" type="hidden" />'+

      '<input id="totalscore0" name="totalscore0" type="hidden" />' +

      '<input id="totalques0" name="totalques0" type="hidden" />' +

      '<input id="compdate0" name="compdate0" type="hidden" />' +

      '</form></div>' +

      " <div class='cpMainContainer' id='cpDocument' style='left: 0px; top:0px;' > <div id='main_container' style='top:0px;position:absolute;'> <div id='projectBorder' style='top:0px;left:0px;position:absolute;display:block'></div> <div class='shadow' id='project_container' style='left: 0px; top:0px;position:absolute;' > <div id='project' class='cp-movie' style='width:640px ;height:480px '> <div id='project_main' class='cp-timeline cp-main'> <div id='div_Slide' onclick='cp.handleClick(event)' style='top:0px; width:640px ;height:480px ;position:absolute;-webkit-tap-highlight-color: rgba(0,0,0,0);'></div> </div> <div id='autoplayDiv' style='display:block;text-align:center;position:absolute;left:0px;top:0px;'> <img id='autoplayImage' src='' style='position:absolute;display:block;vertical-align:middle;'/> <div id='playImage' tabindex='9999' role='button' aria-label='play' onkeydown='cp.CPPlayButtonHandle(event)' onClick='cp.movie.play()' style='position:absolute;display:block;vertical-align:middle;'></div> </div> </div> <div id='toc' style='left:0px; float:left;position:absolute'> </div> <div id='playbar' style='left:0px; float:left;position:absolute'> </div> <div id='cc' style='left:0px; float:left;position:absolute;visibility:hidden;pointer-events:none;' onclick='cp.handleCCClick(event)'> <div id='ccText' style='left:0px;float:left;position:absolute;width:100%;height:100%;'> <p style='margin-left:8px;margin-right:8px;margin-top:2px;'> </p> </div> <div id='ccClose' style='background-image:url(./assets/htmlimages/ccClose.png);right:0px; float:right;position:absolute;cursor:pointer;width:13px;height:11px;' onclick='cp.showHideCC()'> </div> </div> <div id='pwdv' style='display:block;text-align:center;position:absolute;width:100%;height:100%;left:0px;top:0px'></div> <div id='exdv' style='display:block;text-align:center;position:absolute;width:100%;height:100%;left:0px;top:0px'></div> </div> </div></div><div id='blockUserInteraction' class='blocker' style='width:100%;height:100%;'> <table style='width:100%;height:100%;text-align:center;vertical-align:middle' id='loading' class='loadingBackground'> <tr style='width:100%;height:100%;text-align:center;vertical-align:middle'> <td style='width:100%;height:100%;text-align:center;vertical-align:middle'> <image id='preloaderImage'></image> <div id='loadingString' class='loadingString'>Loading...</div> </td> </tr> </table></div> <div id='initialLoading'></div>";

      cp.DoCPInit();

      }

      if((typeof InitAppPackager !== "undefined") && (typeof InitAppPackager === "function"))

      {

      InitAppPackager(cpInit);

      }

      else

      {

      cpInit();

      }

    }

    </script>

    <script type="text/javascript" language="JavaScript">

            //Declare Variables to use and set values

            var strURLBase = "";

            var strURLParams = "";

            var strURLFull = document.location + "";

             var intTemp = strURLFull.indexOf("#");

        //Parse out the Base URL and the Parameters in the URL

        if (intTemp == -1)

            intTemp = strURLFull.indexOf("?");

         if (intTemp > 0)

         strURLParams = strURLFull.substring(intTemp + 1, strURLFull.length);

        var strTemp = location.protocol.toUpperCase();

         if (strTemp.indexOf("FILE") == -1)

        var intTemp = location.pathname.lastIndexOf("/");

        else

        var intTemp = location.pathname.lastIndexOf("\\");

        if (intTemp != -1)

        strURLBase = location.protocol + "//" + location.host + location.pathname.substring(0, intTemp + 1);

        else

        strURLBase = location.protocol + "//" + location.host + location.pathname;

        //Decode the URI so the text looks normal

        strURLParams = decodeURIComponent(strURLParams);

        strURLParams = (strURLParams==""?"":"?") + strURLParams;

        //This function returns a URL parameter value by Name

        function getURLParam(name)

        {

            name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");

            var regexS = "[\\?&]"+name+"=([^&#]*)";

            var regex = new RegExp( regexS );

            var results = regex.exec(strURLParams); //window.location.href );

             if( results == null )

                 return "";

            else

                  return results[1];

        }

    </script>

    </head>

    <body>

      <div id='initialLoading'></div>

    <script>

      (function()

      {

      if(document.documentMode < 9)

      {

      document.body.innerHTML = "";

      document.write("The content you are trying to view is not supported in the current Document Mode of Internet Explorer. Change the Document Mode to Internet Explorer 9 Standards and try to view the content again.<br>To change the Document Mode, press F12, click Document Mode: <current mode>, and then select Internet Explorer 9 Standards.");

      return;

      }

      window.addEventListener("load",function()

      {

      setTimeout(function()

      {

      var script = document.createElement('script');

      script.type = 'text/javascript';

      script.src = 'assets/js/CPXHRLoader.js';

      script.defer = 'defer';

      script.onload = function()

      {

      var lCSSLoaded = false;

      var lJSLoaded = false;

      function constructDIVs()

      {

      if(lCSSLoaded && lJSLoaded)

      {

      initializeCP();

      }

      }

      cpXHRJSLoader.css('assets/css/CPLibraryAll.css',function() {

      lCSSLoaded = true;

      constructDIVs();

      });

      var lJSFiles = [  'assets/js/jquery-1.6.1.min.js','assets/js/CPM.js','assets/playbar/playbarScript.js' ];

      cpXHRJSLoader.js(lJSFiles,function()

      {

      //console.log("js loaded");

      lJSLoaded = true;

      constructDIVs();

      //cpXHRJSLoader.js(['assets/js/jstorage.js', 'assets/js/captivatestorage.js'], function(){});

      });

      }

      document.getElementsByTagName('head')[0].appendChild(script);

      },1);

      },false);

      })();

    </script>

    <noscript style="text-align:center;font-size:24px;">Enable Javascript support in the browser.</noscript>

    <script type="text/javascript">

    //for debugging

    var testing = true; //turn to true to show debugging information for this script

    if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function() {} };

    function getMyData()

    {

    //alert("Hello");

        //cp = document.Captivate;

    //display some data in the console

    //        var bMax = cp.vm.getVariableValue('cpQuizInfoTotalQuizPoints');

    //        var bScore = cp.vm.getVariableValue('cpQuizInfoPointsscored');

    //        var aPercentScore = bMax!=0?bScore/bMax:1;//if max points are zero, then user got 100 no matter what.

    //    var bPercentScore = aPercentScore*100;

     

    //    if(testing){console.log('bMax='+bMax+', bScore'+bScore+', bPercentScore= '+ bPercentScore );}

    //now lets get EVERYTHING and print it out        

    //    $.each(cp.vm.getVariableValue(), function(name, value)

    //    {

    //          if(testing){console.log(name + ": " + value);} //logs value of every single property of the current captivate object (long!)

    //     });

    var myTotalScore = cp.vm.getVariableValue('v_totalscore')

    var myUserID = cp.vm.getVariableValue('v_userid')

    //var myTotalQues = cp.vm.getVariableValue('cpQuizInfoNoQuestionsPerQuiz')

    var myTotalQues = cp.vm.getVariableValue('v_totalques')

    var myProgID = '4'

    //var myLastMod = cp.vm.getVariableValue('v_lastmod')

    var myLastMod = '03'

    var myCurrentDate = cp.vm.getVariableValue('cpInfoCurrentDateString')

    //var myCurrentDate = cp.vm.getVariableValue('v_compdate')

    //var myModDate = cp.vm.getVariableValue('v_moddate');

    var myModDate = cp.vm.getVariableValue('cpInfoCurrentDateString');

    //var myModDate = '7/9/2014'

    var myCompInd = cp.vm.getVariableValue('v_compind')

    //var h = document.getElementById('inpHide');

    //h.value = myCurrentMonth;

    var i = document.getElementById('progid');

    i.value = myProgID;

    var j = document.getElementById('userid');

    j.value = myUserID;

    var k = document.getElementById('lastmod0');

    //k.value = myLastMod;

    if(myLastMod.toString().length == 1){

    k.value='0' + myLastMod}else{k.value = myLastMod};

    var l = document.getElementById('modscore0');

    if(myTotalScore==''){

    l.value=0}else{l.value = myTotalScore};

    var m = document.getElementById('moddate0');

    m.value = myModDate; //'7/7/2014' //'

    var n = document.getElementById('compind0');

    if(myCompInd==''){

    n.value = 0}else{n.value = myCompInd};

    var o = document.getElementById('totalscore0');

    if(myTotalScore==''){

    o.value=0}else{o.value = myTotalScore};

    var p = document.getElementById('totalques0');

    if(myTotalQues==''){

    p.value = 0}else{p.value = myTotalQues};

    var q = document.getElementById('compdate0');

    q.value = myCurrentDate;

    var ln = getURLParam('lname');

    var fn = getURLParam('fname');

    var uid = getURLParam('userid');

    var lm = getURLParam('lastmod');

    var ci = getURLParam('compind');

    var ts = getURLParam('totalscore');

    var tq = getURLParam('totalques');

    var cd = getURLParam('compdate');

    var decodedcd = decodeURIComponent(cd);

        cp.vm.setVariableValue('v_userid', uid);

        cp.vm.setVariableValue('v_lname', ln);

        cp.vm.setVariableValue('v_fname', fn);

        cp.vm.setVariableValue('v_lastmod', lm);

        cp.vm.setVariableValue('v_compind', ci);

        cp.vm.setVariableValue('v_totalscore', ts);

        cp.vm.setVariableValue('v_totalques', tq);

        //cp.vm.setVariableValue('v_compdate', cd);

        cp.vm.setVariableValue('v_compdate', decodedcd);

    document.main.submit();

    }

    function getMyName()

    {

        //cp = document.Captivate;

    //display some data in the console

    var ln = getURLParam('lname');

    var fn = getURLParam('fname');

    var uid = getURLParam('userid');

    var lm = getURLParam('lastmod');

    var ci = getURLParam('compind');

    var ts = getURLParam('totalscore');

    var tq = getURLParam('totalques');

    var cd = getURLParam('compdate');

    var decodedcd = decodeURIComponent(cd);

        cp.vm.setVariableValue('v_userid', uid);

        cp.vm.setVariableValue('v_lname', ln);

        cp.vm.setVariableValue('v_fname', fn);

        cp.vm.setVariableValue('v_lastmod', lm);

        cp.vm.setVariableValue('v_compind', ci);

        cp.vm.setVariableValue('v_totalscore', ts);

        cp.vm.setVariableValue('v_totalques', tq);

        //cp.vm.setVariableValue('v_compdate', cd);

        cp.vm.setVariableValue('v_compdate', decodedcd);

      

    var url = window.location.href;

    if(url.indexOf('&es=') != -1)

    alert("Thank you for completing the program. Your quiz results have been sent to your email address and a copy of the email has been sent to the Arbitration department for our records.");

    }

    function sendEmail()

    {

        //cp = document.Captivate;

    var myTotalScore = cp.vm.getVariableValue('v_totalscore')

    var myUserID = cp.vm.getVariableValue('v_userid')

    var myTotalQues = cp.vm.getVariableValue('v_totalques')

    var myProgID = '4'

    var myLastMod = cp.vm.getVariableValue('v_lastmod')

    var myCurrentDate = cp.vm.getVariableValue('v_compdate')

    var myCompInd = cp.vm.getVariableValue('v_compind')

    var i = document.getElementById('progid');

    i.value = myProgID;

    var j = document.getElementById('userid');

    j.value = myUserID;

    var k = document.getElementById('lastmod0');

    k.value = myLastMod;

    var l = document.getElementById('modscore0');

    if(myTotalScore==''){

    l.value=0}else{l.value = myTotalScore};

    var m = document.getElementById('moddate0');

    m.value = myCurrentDate;

    var n = document.getElementById('compind0');

    if(myCompInd==''){

    n.value = 0}else{n.value = myCompInd};

    var o = document.getElementById('totalscore0');

    if(myTotalScore==''){

    o.value=0}else{o.value = myTotalScore};

    var p = document.getElementById('totalques0');

    if(myTotalQues==''){

    p.value = 0}else{p.value = myTotalQues};

    var q = document.getElementById('compdate0');

    q.value = myCurrentDate;

    var ln = getURLParam('lname');

    var fn = getURLParam('fname');

    var uid = getURLParam('userid');

    var lm = getURLParam('lastmod');

    var ci = getURLParam('compind');

    var ts = getURLParam('totalscore');

    var tq = getURLParam('totalques');

    var cd = getURLParam('compdate');

    var decodedcd = decodeURIComponent(cd);

        cp.vm.setVariableValue('v_userid', uid);

        cp.vm.setVariableValue('v_lname', ln);

        cp.vm.setVariableValue('v_fname', fn);

        cp.vm.setVariableValue('v_lastmod', lm);

        cp.vm.setVariableValue('v_compind', ci);

        cp.vm.setVariableValue('v_totalscore', ts);

        cp.vm.setVariableValue('v_totalques', tq);

        //cp.cpEISetValue('v_compdate', cd);

        cp.vm.setVariableValue('v_compdate', decodedcd);

    document.main.action = "SendEmail.aspx";  

    document.main.submit();

    }  

    </script>

    </body>

    </html>

    Note that on line 18, I added the form element as a string to the document.body.innerHTML.  That should create the form element and allow your code to work.  There's still the matter of when you call getMyData().  I see the function defined in the script tag, but I do not see it actually being called anywhere.

    Legend
    July 30, 2014

    <!DOCTYPE html>

    <html>

    <head>

    <meta name='viewport' content='initial-scale = 1, minimum-scale = 1, maximum-scale = 1'/>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <meta http-equiv="x-ua-compatible" content="IE=10">

    <title></title>

    <style type="text/css">#initialLoading{background:url(assets/htmlimages/loader.gif) no-repeat center center;background-color:#ffffff;position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;z-index:10010;}</style>

    <script>

    function initializeCP()

    {

      function cpInit()

      {

      document.body.innerHTML =  '<div style="display: none; visibility: hidden;"><form id="main" name="main" style="display: none; visibility: hidden;" method="post" action="FLToASPVariable.aspx">' +

      '<input id="inpHide" name="inpHide" type="hidden" />' +

      '<input id="progid" name="progid" type="hidden" />' +

      '<input id="userid" name="userid" type="hidden" />' +

      '<input id="lastmod0" name="lastmod0" type="hidden" />'+

      '<input id="modscore0" name="modscore0" type="hidden" />'+

      '<input id="moddate0" name="moddate0" type="hidden" />' +

      '<input id="compind0" name="compind0" type="hidden" />'+

      '<input id="totalscore0" name="totalscore0" type="hidden" />' +

      '<input id="totalques0" name="totalques0" type="hidden" />' +

      '<input id="compdate0" name="compdate0" type="hidden" />' +

      '</form></div>' +

      " <div class='cpMainContainer' id='cpDocument' style='left: 0px; top:0px;' > <div id='main_container' style='top:0px;position:absolute;'> <div id='projectBorder' style='top:0px;left:0px;position:absolute;display:block'></div> <div class='shadow' id='project_container' style='left: 0px; top:0px;position:absolute;' > <div id='project' class='cp-movie' style='width:640px ;height:480px '> <div id='project_main' class='cp-timeline cp-main'> <div id='div_Slide' onclick='cp.handleClick(event)' style='top:0px; width:640px ;height:480px ;position:absolute;-webkit-tap-highlight-color: rgba(0,0,0,0);'></div> </div> <div id='autoplayDiv' style='display:block;text-align:center;position:absolute;left:0px;top:0px;'> <img id='autoplayImage' src='' style='position:absolute;display:block;vertical-align:middle;'/> <div id='playImage' tabindex='9999' role='button' aria-label='play' onkeydown='cp.CPPlayButtonHandle(event)' onClick='cp.movie.play()' style='position:absolute;display:block;vertical-align:middle;'></div> </div> </div> <div id='toc' style='left:0px; float:left;position:absolute'> </div> <div id='playbar' style='left:0px; float:left;position:absolute'> </div> <div id='cc' style='left:0px; float:left;position:absolute;visibility:hidden;pointer-events:none;' onclick='cp.handleCCClick(event)'> <div id='ccText' style='left:0px;float:left;position:absolute;width:100%;height:100%;'> <p style='margin-left:8px;margin-right:8px;margin-top:2px;'> </p> </div> <div id='ccClose' style='background-image:url(./assets/htmlimages/ccClose.png);right:0px; float:right;position:absolute;cursor:pointer;width:13px;height:11px;' onclick='cp.showHideCC()'> </div> </div> <div id='pwdv' style='display:block;text-align:center;position:absolute;width:100%;height:100%;left:0px;top:0px'></div> <div id='exdv' style='display:block;text-align:center;position:absolute;width:100%;height:100%;left:0px;top:0px'></div> </div> </div></div><div id='blockUserInteraction' class='blocker' style='width:100%;height:100%;'> <table style='width:100%;height:100%;text-align:center;vertical-align:middle' id='loading' class='loadingBackground'> <tr style='width:100%;height:100%;text-align:center;vertical-align:middle'> <td style='width:100%;height:100%;text-align:center;vertical-align:middle'> <image id='preloaderImage'></image> <div id='loadingString' class='loadingString'>Loading...</div> </td> </tr> </table></div> <div id='initialLoading'></div>";

      cp.DoCPInit();

      }

      if((typeof InitAppPackager !== "undefined") && (typeof InitAppPackager === "function"))

      {

      InitAppPackager(cpInit);

      }

      else

      {

      cpInit();

      }

    }

    </script>

    <script type="text/javascript" language="JavaScript">

            //Declare Variables to use and set values

            var strURLBase = "";

            var strURLParams = "";

            var strURLFull = document.location + "";

             var intTemp = strURLFull.indexOf("#");

        //Parse out the Base URL and the Parameters in the URL

        if (intTemp == -1)

            intTemp = strURLFull.indexOf("?");

         if (intTemp > 0)

         strURLParams = strURLFull.substring(intTemp + 1, strURLFull.length);

        var strTemp = location.protocol.toUpperCase();

         if (strTemp.indexOf("FILE") == -1)

        var intTemp = location.pathname.lastIndexOf("/");

        else

        var intTemp = location.pathname.lastIndexOf("\\");

        if (intTemp != -1)

        strURLBase = location.protocol + "//" + location.host + location.pathname.substring(0, intTemp + 1);

        else

        strURLBase = location.protocol + "//" + location.host + location.pathname;

        //Decode the URI so the text looks normal

        strURLParams = decodeURIComponent(strURLParams);

        strURLParams = (strURLParams==""?"":"?") + strURLParams;

        //This function returns a URL parameter value by Name

        function getURLParam(name)

        {

            name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");

            var regexS = "[\\?&]"+name+"=([^&#]*)";

            var regex = new RegExp( regexS );

            var results = regex.exec(strURLParams); //window.location.href );

             if( results == null )

                 return "";

            else

                  return results[1];

        }

    </script>

    </head>

    <body>

      <div id='initialLoading'></div>

    <script>

      (function()

      {

      if(document.documentMode < 9)

      {

      document.body.innerHTML = "";

      document.write("The content you are trying to view is not supported in the current Document Mode of Internet Explorer. Change the Document Mode to Internet Explorer 9 Standards and try to view the content again.<br>To change the Document Mode, press F12, click Document Mode: <current mode>, and then select Internet Explorer 9 Standards.");

      return;

      }

      window.addEventListener("load",function()

      {

      setTimeout(function()

      {

      var script = document.createElement('script');

      script.type = 'text/javascript';

      script.src = 'assets/js/CPXHRLoader.js';

      script.defer = 'defer';

      script.onload = function()

      {

      var lCSSLoaded = false;

      var lJSLoaded = false;

      function constructDIVs()

      {

      if(lCSSLoaded && lJSLoaded)

      {

      initializeCP();

      }

      }

      cpXHRJSLoader.css('assets/css/CPLibraryAll.css',function() {

      lCSSLoaded = true;

      constructDIVs();

      });

      var lJSFiles = [  'assets/js/jquery-1.6.1.min.js','assets/js/CPM.js','assets/playbar/playbarScript.js' ];

      cpXHRJSLoader.js(lJSFiles,function()

      {

      //console.log("js loaded");

      lJSLoaded = true;

      constructDIVs();

      //cpXHRJSLoader.js(['assets/js/jstorage.js', 'assets/js/captivatestorage.js'], function(){});

      });

      }

      document.getElementsByTagName('head')[0].appendChild(script);

      },1);

      },false);

      })();

    </script>

    <noscript style="text-align:center;font-size:24px;">Enable Javascript support in the browser.</noscript>

    <script type="text/javascript">

    //for debugging

    var testing = true; //turn to true to show debugging information for this script

    if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function() {} };

    function getMyData()

    {

    //alert("Hello");

        //cp = document.Captivate;

    //display some data in the console

    //        var bMax = cp.vm.getVariableValue('cpQuizInfoTotalQuizPoints');

    //        var bScore = cp.vm.getVariableValue('cpQuizInfoPointsscored');

    //        var aPercentScore = bMax!=0?bScore/bMax:1;//if max points are zero, then user got 100 no matter what.

    //    var bPercentScore = aPercentScore*100;

     

    //    if(testing){console.log('bMax='+bMax+', bScore'+bScore+', bPercentScore= '+ bPercentScore );}

    //now lets get EVERYTHING and print it out        

    //    $.each(cp.vm.getVariableValue(), function(name, value)

    //    {

    //          if(testing){console.log(name + ": " + value);} //logs value of every single property of the current captivate object (long!)

    //     });

    var myTotalScore = cp.vm.getVariableValue('v_totalscore')

    var myUserID = cp.vm.getVariableValue('v_userid')

    //var myTotalQues = cp.vm.getVariableValue('cpQuizInfoNoQuestionsPerQuiz')

    var myTotalQues = cp.vm.getVariableValue('v_totalques')

    var myProgID = '4'

    //var myLastMod = cp.vm.getVariableValue('v_lastmod')

    var myLastMod = '03'

    var myCurrentDate = cp.vm.getVariableValue('cpInfoCurrentDateString')

    //var myCurrentDate = cp.vm.getVariableValue('v_compdate')

    //var myModDate = cp.vm.getVariableValue('v_moddate');

    var myModDate = cp.vm.getVariableValue('cpInfoCurrentDateString');

    //var myModDate = '7/9/2014'

    var myCompInd = cp.vm.getVariableValue('v_compind')

    //var h = document.getElementById('inpHide');

    //h.value = myCurrentMonth;

    var i = document.getElementById('progid');

    i.value = myProgID;

    var j = document.getElementById('userid');

    j.value = myUserID;

    var k = document.getElementById('lastmod0');

    //k.value = myLastMod;

    if(myLastMod.toString().length == 1){

    k.value='0' + myLastMod}else{k.value = myLastMod};

    var l = document.getElementById('modscore0');

    if(myTotalScore==''){

    l.value=0}else{l.value = myTotalScore};

    var m = document.getElementById('moddate0');

    m.value = myModDate; //'7/7/2014' //'

    var n = document.getElementById('compind0');

    if(myCompInd==''){

    n.value = 0}else{n.value = myCompInd};

    var o = document.getElementById('totalscore0');

    if(myTotalScore==''){

    o.value=0}else{o.value = myTotalScore};

    var p = document.getElementById('totalques0');

    if(myTotalQues==''){

    p.value = 0}else{p.value = myTotalQues};

    var q = document.getElementById('compdate0');

    q.value = myCurrentDate;

    var ln = getURLParam('lname');

    var fn = getURLParam('fname');

    var uid = getURLParam('userid');

    var lm = getURLParam('lastmod');

    var ci = getURLParam('compind');

    var ts = getURLParam('totalscore');

    var tq = getURLParam('totalques');

    var cd = getURLParam('compdate');

    var decodedcd = decodeURIComponent(cd);

        cp.vm.setVariableValue('v_userid', uid);

        cp.vm.setVariableValue('v_lname', ln);

        cp.vm.setVariableValue('v_fname', fn);

        cp.vm.setVariableValue('v_lastmod', lm);

        cp.vm.setVariableValue('v_compind', ci);

        cp.vm.setVariableValue('v_totalscore', ts);

        cp.vm.setVariableValue('v_totalques', tq);

        //cp.vm.setVariableValue('v_compdate', cd);

        cp.vm.setVariableValue('v_compdate', decodedcd);

    document.main.submit();

    }

    function getMyName()

    {

        //cp = document.Captivate;

    //display some data in the console

    var ln = getURLParam('lname');

    var fn = getURLParam('fname');

    var uid = getURLParam('userid');

    var lm = getURLParam('lastmod');

    var ci = getURLParam('compind');

    var ts = getURLParam('totalscore');

    var tq = getURLParam('totalques');

    var cd = getURLParam('compdate');

    var decodedcd = decodeURIComponent(cd);

        cp.vm.setVariableValue('v_userid', uid);

        cp.vm.setVariableValue('v_lname', ln);

        cp.vm.setVariableValue('v_fname', fn);

        cp.vm.setVariableValue('v_lastmod', lm);

        cp.vm.setVariableValue('v_compind', ci);

        cp.vm.setVariableValue('v_totalscore', ts);

        cp.vm.setVariableValue('v_totalques', tq);

        //cp.vm.setVariableValue('v_compdate', cd);

        cp.vm.setVariableValue('v_compdate', decodedcd);

      

    var url = window.location.href;

    if(url.indexOf('&es=') != -1)

    alert("Thank you for completing the program. Your quiz results have been sent to your email address and a copy of the email has been sent to the Arbitration department for our records.");

    }

    function sendEmail()

    {

        //cp = document.Captivate;

    var myTotalScore = cp.vm.getVariableValue('v_totalscore')

    var myUserID = cp.vm.getVariableValue('v_userid')

    var myTotalQues = cp.vm.getVariableValue('v_totalques')

    var myProgID = '4'

    var myLastMod = cp.vm.getVariableValue('v_lastmod')

    var myCurrentDate = cp.vm.getVariableValue('v_compdate')

    var myCompInd = cp.vm.getVariableValue('v_compind')

    var i = document.getElementById('progid');

    i.value = myProgID;

    var j = document.getElementById('userid');

    j.value = myUserID;

    var k = document.getElementById('lastmod0');

    k.value = myLastMod;

    var l = document.getElementById('modscore0');

    if(myTotalScore==''){

    l.value=0}else{l.value = myTotalScore};

    var m = document.getElementById('moddate0');

    m.value = myCurrentDate;

    var n = document.getElementById('compind0');

    if(myCompInd==''){

    n.value = 0}else{n.value = myCompInd};

    var o = document.getElementById('totalscore0');

    if(myTotalScore==''){

    o.value=0}else{o.value = myTotalScore};

    var p = document.getElementById('totalques0');

    if(myTotalQues==''){

    p.value = 0}else{p.value = myTotalQues};

    var q = document.getElementById('compdate0');

    q.value = myCurrentDate;

    var ln = getURLParam('lname');

    var fn = getURLParam('fname');

    var uid = getURLParam('userid');

    var lm = getURLParam('lastmod');

    var ci = getURLParam('compind');

    var ts = getURLParam('totalscore');

    var tq = getURLParam('totalques');

    var cd = getURLParam('compdate');

    var decodedcd = decodeURIComponent(cd);

        cp.vm.setVariableValue('v_userid', uid);

        cp.vm.setVariableValue('v_lname', ln);

        cp.vm.setVariableValue('v_fname', fn);

        cp.vm.setVariableValue('v_lastmod', lm);

        cp.vm.setVariableValue('v_compind', ci);

        cp.vm.setVariableValue('v_totalscore', ts);

        cp.vm.setVariableValue('v_totalques', tq);

        //cp.cpEISetValue('v_compdate', cd);

        cp.vm.setVariableValue('v_compdate', decodedcd);

    document.main.action = "SendEmail.aspx";  

    document.main.submit();

    }  

    </script>

    </body>

    </html>

    Ruth_HBAuthor
    Known Participant
    July 30, 2014

    Thanks so much, Jim! This is helpful. We appreciate you working through the code for us. So it seems as though, the program is able to be loaded, but we're getting this error.

    Any ideas? So it's still not pulling in the variables because of the error above.

    To answer your question about getMyData();, that's being called in the actual Captivate file itself. So when a user clicks the "next" button after viewing a screen, it executes that javascript and send the data to the database.

    Legend
    July 29, 2014

    Hi Ruth,

    When is getMyData() being called?  It may be that the HTML5 course has not fully loaded when that function is being called so it fails.  When you open the javascript console in chrome (CTRL+SHIFT+J), do you see any errors listed?

    If your course is online, I'd be happy to take a look for you.

    Best,

    Jim Leichliter

    Ruth_HBAuthor
    Known Participant
    July 29, 2014

    Hi Jim,

    Thanks for that tip. Unfortunately, the project is currently on our test servers which isn't accessible externally.

    When I do open the javascript console, the error says "Uncaught ReferenceError: cp is not defined" and "Uncaught TypeError: undefined is not a function".

    Legend
    July 29, 2014

    That's actually really helpful.  So from reading your earlier posts, it sounds like the getMyData() function lives inside of index.html inside of <script> tags.  When is this function being called?  If it's called before the cp object is created, then the error you are receiving makes complete sense.  You can avoid this timing issue if you call getMyData() from inside of Captivate itself.  When you do call it, you may need to preface it with window.getMyData();

    Ruth_HBAuthor
    Known Participant
    July 25, 2014

    Here's part of the function that passes a variable into the database that worked previously in Captivate 7.0.0.118

    function getMyData(){

    var myLastMod = cp.vm.getVariableValue('v_lastmod')

    var k = document.getElementById('lastmod0');

    if(myLastMod.toString().length == 1){

    k.value='0' + myLastMod}else{k.value = myLastMod};

    var lm = getURLParam('lastmod');

    document.main.submit();

    }

    It seems to be ignored in the patched Captivate index.html when placed inline.