Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-16299

Javascript error during scorm player load

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.9, 2.0
    • Fix Version/s: 1.8, 1.8.7, 1.9.3, 2.0
    • Component/s: SCORM
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      Javascript error during scorm player load. Bug around form parameter scoid, which has no value - locallib.php line 644 <input type="hidden" name="scoid"/>. This parameter needs to be correctly populated for the FORM POST.

      Additional details as reported by Suvrat Sharma:
      Hi,

      I have been getting javascript alert error messages "Unable to find api" when opening scorm player. After some investigation I found that error message comes only when request is send as POST. With GET request it works fine.
      Also I see that in file locallib.php - function scorm_view_display there are two hidden input fields with same name "scoid" and with only one field being initialized with value. here's the sample code of function with two input fields in blue color:

      <form id="theform" method="post" action="<?php echo $CFG->wwwroot ?>/mod/scorm/player.php?scoid=<?php echo $sco->id ?>&id=<?php echo $cm->id ?>"<?php echo $scorm->popup == 1?' target="newwin"':'' ?>>
      <?php
      if ($scorm->hidebrowse == 0) {
      print_string('mode','scorm');
      echo '<input type="hidden" name="scoid" value="'.$sco->id.'" />'."\n";
      echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">'.get_string('browse','scorm').'</label>'."\n";
      echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">'.get_string('normal','scorm')."</label>\n";
      } else {
      echo '<input type="hidden" name="mode" value="normal" />'."\n";
      }
      if (($incomplete === false) && (($result->attemptleft > 0)||($scorm->maxattempt == 0))) {
      ?>
      <br />
      <input type="checkbox" id="a" name="newattempt" />
      <label for="a"><?php print_string('newattempt','scorm') ?></label>
      <?php
      }
      ?>
      <br />
      <input type="hidden" name="scoid"/>
      <input type="hidden" name="currentorg" value="<?php echo $orgidentifier ?>" />
      <input type="submit" value="<?php print_string('entercourse','scorm') ?>" />
      </form>

      I believe in my case form gets posted with two scoid fields and player.php takes the empty value for scoid. Url for js file is like "scorm/api.php?id=48065&scoid=&mode=browse&attempt=1".
      I use moodle 1.8.2 with firefox 3.0.1. I have checked the latest moodle version also and there also I don't find any correction in locallib.php file. So I wonder if two input fields with same name serves any purpose or is just a bug !!

      Thanks,
      Suvrat

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  31/Mar/07