Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.7, 1.9.3, 2.0
    • Component/s: Forms Library, SCORM
    • Labels:
      None
    • Environment:
      Windows XP SP2, MySQL, Apache, IE7 (and Firefox)
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      28912

      Description

      If I install Moodle 1.8 Windows complete package, let the database install and complete first setup, then rename the moodle folder to moodle-1.7 and extract the latest moodle-1.8 generic build in its place, then go to the /admin/ page and authenticate as administrator to apply the database table changes, then create a new course in the Miscellaneous group, then automatically get prompted to Add an AICC/SCORM package, then choose to upload the package as uploaded to http://www.peterchamberlin.dsl.pipex.com/M2775101-2004.zip, then provide a title and description for it and then click the Save Changes button then...

      I get the following JavaScript error to begin with:

      Line: 189
      Char: 3
      Error: 'parentNode' is null or not an object
      Code: 0
      URL: http://ws806/course/modedit.php?add=scorm&type=&course=2&section=0&return=0

      This is caused by:
      function validate_mod_scorm_mod_form_reference(element) {
      var frm = element.parentNode; // This line

      Which is called by:
      ret = validate_mod_scorm_mod_form_reference(frm.elements['reference']) && ret

      Which fails because there's no such element "reference"

      Getting past this error then results in a pause while the package is extracted and made ready to be added to the course and then I receive an empty HTML page and no error message. If I wipe down the filename and go to the /course/ folder then I see that the package has not been added and it goes through the auto-add process again. I see that the package files have been extracted to course folder "2" but in the \moodledata\2\moddata\scorm\KdkWOQVF\ folder I see some of the extracted files and the package .zip file - but in checking what's been extracting I see that the operation stopped before file \M2775101\help\help\measureDCVoltage_images\MeasureDCVoltage_04.jpg was in place. On repeating this entire process in Firefox I note that the extraction stops around the same place, but not on the exact file. Firefox also raises a JavaScript error and receives an empty page in response to the Save Changes form submission.

      This seems like a pretty major fault to have in a 1.8 version that's being "polished". It seems to be package specific as most of my generated content files, and some from other vendors, goes wrong in a similar manor. Others work fine. Our package is SCORM 2004 3rd Edition conformant.

      1. MDL-9077-head.patch
        1 kB
        Piers Harding
      2. MDL-9077-moodle18.patch
        1 kB
        Piers Harding
      3. MDL-9077-moodle18.patch
        1 kB
        Piers Harding

        Issue Links

          Activity

          Hide
          Peter Chamberlin added a comment -

          This issue also occurs with a SCORM 1.2 conformant package in Moodle 1.8 (31st March release).

          Try importing the package at:
          http://www.peterchamberlin.dsl.pipex.com/M2582801_C01-1.2.zip (29.52Mb)

          This package imports fine in Moodle 1.7.2

          I cannot get any error information, even when setting debugging mode to high and developer levels. Well, under 'developer' I can't even get to the import page due to XSL parser errors.

          Show
          Peter Chamberlin added a comment - This issue also occurs with a SCORM 1.2 conformant package in Moodle 1.8 (31st March release). Try importing the package at: http://www.peterchamberlin.dsl.pipex.com/M2582801_C01-1.2.zip (29.52Mb) This package imports fine in Moodle 1.7.2 I cannot get any error information, even when setting debugging mode to high and developer levels. Well, under 'developer' I can't even get to the import page due to XSL parser errors.
          Hide
          Peter Chamberlin added a comment -

          Why has there been no response to this bug report? The issue is still present with my latest SCORM 1.2 packages on Moodle 1.8 latest daily build, including the simple JavaScript error.

          Is it because the "bug fixes for Moodle 1.8.x" link at the top of this page doesn't actually reference this tracked issue? That's because the filter settings associated with request 10077 doesn't include "Affects version 1.8" or 1.8.1

          Change the Component field to SCORM?

          Show
          Peter Chamberlin added a comment - Why has there been no response to this bug report? The issue is still present with my latest SCORM 1.2 packages on Moodle 1.8 latest daily build, including the simple JavaScript error. Is it because the "bug fixes for Moodle 1.8.x" link at the top of this page doesn't actually reference this tracked issue? That's because the filter settings associated with request 10077 doesn't include "Affects version 1.8" or 1.8.1 Change the Component field to SCORM?
          Hide
          Jose Martin added a comment -

          Hi Peter, I have the same error. I think that the problem could be that the script stop after x seconds. When I try with a small course it works OK, but if the Packege is over 6 MB fails.

          Show
          Jose Martin added a comment - Hi Peter, I have the same error. I think that the problem could be that the script stop after x seconds. When I try with a small course it works OK, but if the Packege is over 6 MB fails.
          Hide
          Peter Chamberlin added a comment -

          This issue does seem to be timeout related, since I produced a smaller 1.2 package and that imported okay (a very small package).

          I found the following issue: http://tracker.moodle.org/browse/MDL-9557

          This points things the way of the scorm_delete_files() function in mod\scorm\locallib.php where a set_time_limit(5) limits the maximum tree deletion ability for top nodes..

          Hopefully someone will fix this bug (and the JavaScript form submission one), until then at least I have something to recommend to clients to adjust to avoid this issue in 1.8

          Show
          Peter Chamberlin added a comment - This issue does seem to be timeout related, since I produced a smaller 1.2 package and that imported okay (a very small package). I found the following issue: http://tracker.moodle.org/browse/MDL-9557 This points things the way of the scorm_delete_files() function in mod\scorm\locallib.php where a set_time_limit(5) limits the maximum tree deletion ability for top nodes.. Hopefully someone will fix this bug (and the JavaScript form submission one), until then at least I have something to recommend to clients to adjust to avoid this issue in 1.8
          Hide
          Martin Dougiamas added a comment -

          I've fixed MDL-9557, thanks for the detection (and please file bugs with the correct categories).

          Not sure about the JS one.

          Show
          Martin Dougiamas added a comment - I've fixed MDL-9557 , thanks for the detection (and please file bugs with the correct categories). Not sure about the JS one.
          Hide
          Martin Dougiamas added a comment -

          Bob, can you look at the JS error here? Seems pretty basic.

          Show
          Martin Dougiamas added a comment - Bob, can you look at the JS error here? Seems pretty basic.
          Hide
          Martin Dougiamas added a comment -

          Bobo not Bob :-D

          Show
          Martin Dougiamas added a comment - Bobo not Bob :-D
          Hide
          Roberto Pinna added a comment -

          ok
          I'll take a look this evening.

          Bobo.

          Show
          Roberto Pinna added a comment - ok I'll take a look this evening. Bobo.
          Hide
          Roberto Pinna added a comment -

          The JS error is in libform generated javascript code.

          By the way I get no problem during importing the big package on Moodle 1.8+.
          It's imported and played without problems.

          Show
          Roberto Pinna added a comment - The JS error is in libform generated javascript code. By the way I get no problem during importing the big package on Moodle 1.8+. It's imported and played without problems.
          Hide
          CommLab India added a comment -

          Hi,

          we were also getting the same error in moodle 1.9 while uploading scorm 1.2 courses.

          we found the problem to be in mod/scorm/mod_form.php at the code:
          $mform->addRule('reference', get_string('required'), 'required', null, 'client');

          The error was occuring at the argument 'reference'. When we checked the source code of the page (Adding a new SCORM/AICC), we found the input box name of "Package file" as 'reference[value]'. We changed the argument to "reference[value]". That is, $mform->addRule('reference[value]', get_string('required'), 'required', null, 'client');

          It works fine!

          Regards,

          CommLab India

          Show
          CommLab India added a comment - Hi, we were also getting the same error in moodle 1.9 while uploading scorm 1.2 courses. we found the problem to be in mod/scorm/mod_form.php at the code: $mform->addRule('reference', get_string('required'), 'required', null, 'client'); The error was occuring at the argument 'reference'. When we checked the source code of the page (Adding a new SCORM/AICC), we found the input box name of "Package file" as 'reference [value] '. We changed the argument to "reference [value] ". That is, $mform->addRule('reference [value] ', get_string('required'), 'required', null, 'client'); It works fine! Regards, CommLab India
          Hide
          Dan Marsden added a comment -

          assigning to Piers - can you please check this out? - it doesn't happen 100% of the time, so I wonder if different versions of JS handle it differently? - or if reference is set differently under certain conditions?

          Dan

          Show
          Dan Marsden added a comment - assigning to Piers - can you please check this out? - it doesn't happen 100% of the time, so I wonder if different versions of JS handle it differently? - or if reference is set differently under certain conditions? Dan
          Hide
          CommLab India added a comment -

          Hi Dan,

          When ever we use to upload SCORM/AICC courses, we use to get this error both in offline and online versions.

          Line: 205
          Error: 'parentNode' is null or not an object

          We changed the argument to "reference[value]" directly without any conditions.

          Regards,

          CommLab India

          Show
          CommLab India added a comment - Hi Dan, When ever we use to upload SCORM/AICC courses, we use to get this error both in offline and online versions. Line: 205 Error: 'parentNode' is null or not an object We changed the argument to "reference [value] " directly without any conditions. Regards, CommLab India
          Hide
          Piers Harding added a comment -

          Hi Dan/ CommLab India -
          In STABLE18 I can recreate the problem with "Error: 'parentNode' is null or not an object" in IE7 (and only IE - it never happens in that FF3 that I can discern). But, in HEAD, I get a different problem that seems to be happening earlier.
          function validate_mod_scorm_mod_form(frm) throws an error at frm.elements['summary'].focus(); But this maybe happening for similar reasons to do with finding the parent form (I need to find a decent debugger for IE to really track this down).
          Changing the argument to "reference[value]" masks the problem as it removes the validation routine, which then never gets executed... problem goes away.
          It would great to get the maintainers of the core input form handling routines to comment on this (not sure who they are).

          Cheers,
          Piers Harding.

          Show
          Piers Harding added a comment - Hi Dan/ CommLab India - In STABLE18 I can recreate the problem with "Error: 'parentNode' is null or not an object" in IE7 (and only IE - it never happens in that FF3 that I can discern). But, in HEAD, I get a different problem that seems to be happening earlier. function validate_mod_scorm_mod_form(frm) throws an error at frm.elements ['summary'] .focus(); But this maybe happening for similar reasons to do with finding the parent form (I need to find a decent debugger for IE to really track this down). Changing the argument to "reference [value] " masks the problem as it removes the validation routine, which then never gets executed... problem goes away. It would great to get the maintainers of the core input form handling routines to comment on this (not sure who they are). Cheers, Piers Harding.
          Hide
          Piers Harding added a comment -

          Hi - after some more debugging I have narrowed down the problem in STABLE18 to a mismatch in names of the form fields and the expected names in the associated validation javascript - it's looking for reference where the actual name is reference[value].
          The attached patch file MDL-9077-moodle18.patch demonstrates a hack-around for the problem by patching formslib.php, but I am not confident that this is the right solution (the maintainer for formslib.php would have a better handle on it).

          Would be good to have the right eyes on this one.

          Cheers,
          Piers Harding.

          Show
          Piers Harding added a comment - Hi - after some more debugging I have narrowed down the problem in STABLE18 to a mismatch in names of the form fields and the expected names in the associated validation javascript - it's looking for reference where the actual name is reference [value] . The attached patch file MDL-9077 -moodle18.patch demonstrates a hack-around for the problem by patching formslib.php, but I am not confident that this is the right solution (the maintainer for formslib.php would have a better handle on it). Would be good to have the right eyes on this one. Cheers, Piers Harding.
          Hide
          Dan Marsden added a comment -

          adding the formslib maintainer - Jamie would you mind reviewing the patch above from Piers? - any comments?

          thanks!

          Dan

          Show
          Dan Marsden added a comment - adding the formslib maintainer - Jamie would you mind reviewing the patch above from Piers? - any comments? thanks! Dan
          Hide
          Jamie Pratt added a comment -

          hi,

          Sorry client side validation is not supported for this element type.

          I would suggest to remove the 'client' param from the call to addRule :

          $mform->addRule('reference', get_string('required'), 'required', null);

          Then the rule will be checked on the server side.

          If someone wanted to work through the js used for client side validation and suggest some solid patches that would be great. Most of the js is taken directly from the pear QuickForm library.

          Jamie

          Show
          Jamie Pratt added a comment - hi, Sorry client side validation is not supported for this element type. I would suggest to remove the 'client' param from the call to addRule : $mform->addRule('reference', get_string('required'), 'required', null); Then the rule will be checked on the server side. If someone wanted to work through the js used for client side validation and suggest some solid patches that would be great. Most of the js is taken directly from the pear QuickForm library. Jamie
          Hide
          Piers Harding added a comment -

          After correcting the reference field JS validation problem, I stumbled upon another to do with validation (client, and server) of textarea fields that have an html editor attached. When the validation fails it attempts to set the focus() on the textarea which has been masked by the iframe of the html editor.
          The attached patch MDL-9077-moodle18.patch checks to see if an element is a textarea, and whether the user has htmleditor enabled - if so it bypasses the focus() call.

          This issue affects all forms that use the htmleditor.

          Cheers,
          Piers Harding.

          Show
          Piers Harding added a comment - After correcting the reference field JS validation problem, I stumbled upon another to do with validation (client, and server) of textarea fields that have an html editor attached. When the validation fails it attempts to set the focus() on the textarea which has been masked by the iframe of the html editor. The attached patch MDL-9077 -moodle18.patch checks to see if an element is a textarea, and whether the user has htmleditor enabled - if so it bypasses the focus() call. This issue affects all forms that use the htmleditor. Cheers, Piers Harding.
          Hide
          Piers Harding added a comment -

          Try again - get the right file this time - MDL-9077-head.patch.

          Show
          Piers Harding added a comment - Try again - get the right file this time - MDL-9077 -head.patch.
          Hide
          Piers Harding added a comment -

          I am linking these two issues together because there is a correlation between the form javascript errors and the how the htmleditor overwrites/masks DOM associated DOM elements. It is worthwhile observing the difference between testing with and without the htmleditor enabled in the user settings - it cures the textarea validation issue (htmleditor being disabled).

          Cheers,
          Piers Harding.

          Show
          Piers Harding added a comment - I am linking these two issues together because there is a correlation between the form javascript errors and the how the htmleditor overwrites/masks DOM associated DOM elements. It is worthwhile observing the difference between testing with and without the htmleditor enabled in the user settings - it cures the textarea validation issue (htmleditor being disabled). Cheers, Piers Harding.
          Hide
          Dan Marsden added a comment -

          thanks Piers - that patch doesn't cause the scorm package import failure, so I've copied your patch to MDL-15019 so we can close this bug off when your other patch goes into the stable trees.

          Show
          Dan Marsden added a comment - thanks Piers - that patch doesn't cause the scorm package import failure, so I've copied your patch to MDL-15019 so we can close this bug off when your other patch goes into the stable trees.
          Hide
          Dan Marsden added a comment -

          btw - thanks Jamie! - Piers is going to move the validation so it runs server side!

          Dan

          Show
          Dan Marsden added a comment - btw - thanks Jamie! - Piers is going to move the validation so it runs server side! Dan
          Hide
          Dan Marsden added a comment -

          Hi Piers,
          this patch looks fine:
          http://cvs.moodle.org/moodle/mod/scorm/mod_form.php?r1=1.12&r2=1.13

          can you please apply this to 1.8stable and 1.9stable? - then we can close this bug.

          thanks,

          Dan

          Show
          Dan Marsden added a comment - Hi Piers, this patch looks fine: http://cvs.moodle.org/moodle/mod/scorm/mod_form.php?r1=1.12&r2=1.13 can you please apply this to 1.8stable and 1.9stable? - then we can close this bug. thanks, Dan
          Hide
          Piers Harding added a comment -

          Changed the reference field validation to server side as described, and propagated the fix to 1.8, and 1.9.

          Cheers.

          Show
          Piers Harding added a comment - Changed the reference field validation to server side as described, and propagated the fix to 1.8, and 1.9. Cheers.
          Hide
          Dan Marsden added a comment -

          Closing - great! - good work Piers

          Dan

          Show
          Dan Marsden added a comment - Closing - great! - good work Piers Dan

            People

            • Votes:
              6 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: