JavaScript Error "TypeError" in yui_combo.php

Re: JavaScript Error "TypeError" in yui_combo.php

by Mario Ofner -
Number of replies: 0

Hy There,


What i found so far to this issue so far is the following:

After a click on "edit settings" for a course edit.php is called, and gets rendered.



The JavaScript error occures in the following function:

Y.extend(FORMATCHOOSER, Y.Base, {

    initializer : function(params) {

        if (params && params.formid) {

            var updatebut = Y.one('#'+params.formid+' #id_updatecourseformat');

            var formatselect = Y.one('#'+params.formid+' #id_format');

            var ancestor = updatebut.ancestor('fieldset');

            var action = Y.one('form.mform').get('action');

            if (updatebut && formatselect) {

                updatebut.setStyle('display', 'none');

                formatselect.on('change', function() {

                    Y.one('form.mform').set('action', action + '#' + ancestor.get('id'));

                    updatebut.simulate('click');

                });

            }

        }

    }

});


I think it is in file: "course/yui/src/formatchooser/js/formatchooser.js"

But the variable "updatebut" is not set, because the id: id_updatecourseformat does not exist in the rendered page.

What i found in the new Version (Moodle Demo):

<div id="fitem_id_updatecourseformat" class="fitem fitem_actionbuttons fitem_fsubmit "><div class="felement fsubmit"><input name="updatecourseformat" value="Update format" type="submit" onclick="skipClientValidation = true;" id="id_updatecourseformat"/></div></div>

<div id="fitem_id_numsections" class="fitem fitem_fselect  "><div class="fitemtitle"><label for="id_numsections">Number of sections </label></div><div class="felement fselect"><select name="numsections" id="id_numsections">


Rendered with my installed Version (moodle-3.1.2):

<div id="fitem_qf_c490d2" class="fitem fitem_actionbuttons fitem_fsubmit "><div class="felement fsubmit"><input name="updatecourseformat" value="Update format" type="submit" onclick="skipClientValidation = true;" id="qf_c490d2" /></div></div>

<div id="fitem_qf_68bb80" class="fitem fitem_fselect  "><div class="fitemtitle"><label for="qf_68bb80">Number of sections </label></div><div class="felement fselect"><select name="numsections" id="qf_68bb80">



So the id is generated before rendering, and because of the different name the yui component cannot find the correct element.


Is it possible, that there is a inconsistent state of the moodle package in RHEL?


Any ideas?

- Mario