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

    Details

    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull 3.8 Branch:
    • Pull 3.9 Branch:
    • Pull Master Branch:

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marina Marina Glancy
              Reporter:
              marina Marina Glancy
              Peer reviewer:
              David Matamoros
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/20

                  Time Tracking

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