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

Javascript Filepicker breaks in database module under certain conditions

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Open the browser's JS console and ensure you don't see any JS error during all the test
      2. Create a database activity on a course
      3. Add two file fields (file1, file2) and two picture fields (picture1, picture2)
      4. Under templates->add template remove the reference to file1 and to picture1 so they are not included in the template
      5. Click "add entry" to view the upload template,
      6. Make sure you can upload the second file and the second picture and add entry
      Show
      Open the browser's JS console and ensure you don't see any JS error during all the test Create a database activity on a course Add two file fields (file1, file2) and two picture fields (picture1, picture2) Under templates->add template remove the reference to file1 and to picture1 so they are not included in the template Click "add entry" to view the upload template, Make sure you can upload the second file and the second picture and add entry
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-46500_master

      Description

      Create a database
      Add two file fields
      file1
      file2
      under templates->add template
      remove the reference to file1 so it is not included in the template
      click "add entry" to view the upload template,
      you will only see the spinning loading gif
      a javascript error will be in the console "Uncaught TypeError: Cannot read property 'removeClass' of null "
      or
      "TypeError: filemanager is null"

      This occurs because the javascript is passed the id of each field in the template (regardless of if it is displayed or not), since we removed the field from the template the javascript has amn error as the id does not exist.
      It then does not finish loading the rest of the file pickers

      removing the unused field is a temp fix
      it also works fine with javascript disabled

        Attachments

          Activity

            People

            Assignee:
            berserkk Ben Kelada
            Reporter:
            berserkk Ben Kelada
            Peer reviewer:
            David Monllaó
            Integrator:
            Damyon Wiese
            Tester:
            Simey Lameze
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Nov/14