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

Modify the formchangedchecker javascript function to ignore form elements with the class "ignoredirty".

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3.2
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide

      Initially check for regressions

      • Open a course page
      • Turn editing on
      • Add a new activity - I chose Page
      • Refresh the page
        • Confirm that the page refreshes and doesn't show any warnings
      • Set a title
      • Refresh the page
        • Confirm that you get a warning message
        • Reload the page anyway
      • Set a title but do not leave focus from the form element
      • Refresh the page
        • Confirm that you get a warning message
        • Reload the page anyway

      Testing a broken form

      • Add a new Assignment to the course
      • View the submitted assignments using the 'View/grade all submissions' link
      • Tick the 'Quick grading' checkbox at the bottom of the page
        • Confirm that the page warns you even though you haven't made any other changes
      • Edit mod/assign/gradingoptionsform.php and change the quickgrading checkbox to add the ignoredirty class:

        $mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '', array('class' => 'ignoredirty'));

      • Refresh the submitted assignments page
      • Tick the 'Quick grading' checkbox at the bottom of the page
        • Confirm that the page reloads without warning
      • Enter a grade for a student
      • Tick the 'Quick grading' checkbox at the bottom of the page
        • Confirm that you get a warning message this time
      • Edit mod/page/mod_form.php and change the name textbox to add the ignoredirty class:

        $mform->addElement('text', 'name', get_string('name'), array('size'=>'48', 'class' => 'ignoredirty'));

      • Add a new Page on a course
      • Set a title but do not leave focus from the form element
      • Refresh the page
        • Confirm that you do not get a warning message
      Show
      Initially check for regressions Open a course page Turn editing on Add a new activity - I chose Page Refresh the page Confirm that the page refreshes and doesn't show any warnings Set a title Refresh the page Confirm that you get a warning message Reload the page anyway Set a title but do not leave focus from the form element Refresh the page Confirm that you get a warning message Reload the page anyway Testing a broken form Add a new Assignment to the course View the submitted assignments using the 'View/grade all submissions' link Tick the 'Quick grading' checkbox at the bottom of the page Confirm that the page warns you even though you haven't made any other changes Edit mod/assign/gradingoptionsform.php and change the quickgrading checkbox to add the ignoredirty class: $mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'), '', array('class' => 'ignoredirty')); Refresh the submitted assignments page Tick the 'Quick grading' checkbox at the bottom of the page Confirm that the page reloads without warning Enter a grade for a student Tick the 'Quick grading' checkbox at the bottom of the page Confirm that you get a warning message this time Edit mod/page/mod_form.php and change the name textbox to add the ignoredirty class: $mform->addElement('text', 'name', get_string('name'), array('size'=>'48', 'class' => 'ignoredirty')); Add a new Page on a course Set a title but do not leave focus from the form element Refresh the page Confirm that you do not get a warning message
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-33874-master-2

      Description

      In the assignment module (and probably elsewhere in Moodle) there are certain form elements that do not require dirty/change tracking. The dirty/change tracking is what prompts the "You have unsaved changes" dialog when you leave the page without submitting the form. In the assignment grading page it would be nice to disable this functionality for the selection checkboxes and the batch grading actions form.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    10/Sep/12