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

formautosubmit.js does not check whether select is valid before acting on it

    Details

    • Testing Instructions:
      Hide
      • Open a course
      • Open JS console
      • Turn editing on
        • Confirm no errors or warnings were shown
      • Turn off the activity chooser
      • Try using one of the 'Add a new...' dropdowns to make a selection
        • Confirm no errors or warnings were shown
        • Confirm that the page redirected

      For Moodle 2.3 only:

      • Create a scorm activity using the attached scorm file.
      • Make sure the display course structure in player setting is set to "To the side".
      • Enter the scorm
        • Confirm no errors or warnings were shown
      Show
      Open a course Open JS console Turn editing on Confirm no errors or warnings were shown Turn off the activity chooser Try using one of the 'Add a new...' dropdowns to make a selection Confirm no errors or warnings were shown Confirm that the page redirected For Moodle 2.3 only: Create a scorm activity using the attached scorm file. Make sure the display course structure in player setting is set to "To the side". Enter the scorm Confirm no errors or warnings were shown
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:

      Description

      Launches previously working in Moodle 2.3.2 fail in Moodle 2.3.3+ (Build: 20121230)

      Issue appears to be in the TOC generation logic, but actually manifests in the use of the new moodle-core-formautosubmit javascript in http://git.moodle.org/gw?p=moodle.git;a=blob;f=lib/yui/formautosubmit/formautosubmit.js;h=01d666879c801dcddc4c9377eb97189b1679134d;hb=MOODLE_23_STABLE#l43

      The TOC code creates a single select with the outputrender code that registers the moodle-core-formautosubmit to add itself to the "dropdown".
      http://git.moodle.org/gw?p=moodle.git;a=blob;f=lib/outputrenderers.php;h=bc89a754f8d7464f37efba460a8dd021ad868333;hb=MOODLE_23_STABLE#l1359

      However the dropdown is not always displayed and so the javascript code will not detect it and blocks the operation continuing, a javascript error is generated.
      http://git.moodle.org/gw?p=moodle.git;a=blob;f=mod/scorm/player.php;h=570543d06c9e35be02f89dfea02763899dc0cb0c;hb=MOODLE_23_STABLE#l214

      NOTE: $result->tocmenu is the single select

      A quick fix is editing the moodle-core-formautosubmit and having it check that the "select" it is attempting to bind to exists.

      http://git.moodle.org/gw?p=moodle.git;a=blob;f=lib/yui/formautosubmit/formautosubmit.js;h=01d666879c801dcddc4c9377eb97189b1679134d;hb=MOODLE_23_STABLE#l43

      //martin_holden@skillsoft.com 20130106 - Add a check that the select exists before we try anything
      //as issues with SCORM/AICC launches
      if (thisselect != null)

      { thisselect.setData('nothing', this.get('nothing')); thisselect.setData('startindex', thisselect.get('selectedIndex')); }

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  12 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13