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

Invalid argument error when setting up sections in AJAX course

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7.1, 1.8
    • Component/s: JavaScript
    • Labels:
      None
    • Environment:
      Internet Explorer 6
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE

      Description

      In Internet Explorer 6 there is an "invalid argument" JS error if you have an empty section in a course.

      This line of section_class.prototype.process_section is the culprit:

      this.content_td.insertBefore(this.resources_ul, this.content_td.childNodes[2]);

      With an empty section this.content_td.childNodes seems to (sometimes?) only have 2 items in it - hence this.content_td.childNodes[2] is undefined and insertBefore gets upset. At first I thought this only happened if you had a course in topics format, but it seems to sometimes also happen in weekly format?

      Assuming we want the resources list inserted just before the add resource/activity drop down lists and that the div containing these select boxes is the last element in the section, maybe something like this would work instead?

      this.content_td.insertBefore(this.resources_ul, this.content_td.lastChild);

        Attachments

          Activity

            People

            Assignee:
            vyshane Vy-Shane Sin Fat
            Reporter:
            catbert Andrew Walker
            Tester:
            Nobody
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              17/Jan/07