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

When a form is frozen (editable=false), the console is full of javascript errors

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • MOODLE_38_STABLE, MOODLE_39_STABLE
    • Hide

      0. Ensure your site has 2-3 languages installed. You can install extra languages going to "Admin -> Language -> Language packs", selecting 2-3 languages and clicking on "Install selected language packs".

      1. Open user/language.php and substitute the line 39 with

      diff --git a/user/language.php b/user/language.php
      index ef2b09fd9d4..ab7e9128b4a 100644
      --- a/user/language.php
      +++ b/user/language.php
      @@ -36,7 +36,8 @@ $PAGE->set_url('/user/language.php', array('id' => $userid, 'course' => $coursei
       list($user, $course) = useredit_setup_preference_page($userid, $courseid);
       
       // Create form.
      -$languageform = new user_edit_language_form(null, array('userid' => $user->id));
      +$languageform = new user_edit_language_form(null, array('userid' => $user->id), null, null, null, false);
      +
       $languageform->set_data($user);
       
       $redirect = new moodle_url("/user/preferences.php", array('userid' => $user->id));
      

      2. Go to your user preferences, click "Preferred language"

      • Make sure the form is frozen (cannot make any change to select other "Preferred language").
      • Verify that the lang drop down menu in the page header shows the languages that were installed in step 0.
      • Verify that there are no errors in the JS console.
      Show
      0. Ensure your site has 2-3 languages installed. You can install extra languages going to "Admin -> Language -> Language packs", selecting 2-3 languages and clicking on "Install selected language packs". 1. Open user/language.php and substitute the line 39 with diff --git a/user/language.php b/user/language.php index ef2b09fd9d4..ab7e9128b4a 100644 --- a/user/language.php +++ b/user/language.php @@ -36,7 +36,8 @@ $PAGE->set_url('/user/language.php', array('id' => $userid, 'course' => $coursei list($user, $course) = useredit_setup_preference_page($userid, $courseid); // Create form. -$languageform = new user_edit_language_form(null, array('userid' => $user->id)); +$languageform = new user_edit_language_form(null, array('userid' => $user->id), null, null, null, false); + $languageform->set_data($user); $redirect = new moodle_url("/user/preferences.php", array('userid' => $user->id)); 2. Go to your user preferences, click "Preferred language" Make sure the form is frozen (cannot make any change to select other "Preferred language"). Verify that the lang drop down menu in the page header shows the languages that were installed in step 0. Verify that there are no errors in the JS console.

      The 6th argument to the moodleform constructor is the $editable . When set to false, the whole form becomes frozen.

      In the template for the frozen form the <form> tag is replaced with <div class="mform frozen">

      The javascript introduced in MDL-67876 expects the parent "form" element to be always present

            marina Marina Glancy
            marina Marina Glancy
            David Carrillo David Carrillo
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 45 minutes
                5h 45m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.