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

HideIf does not work well with groups (especially with clean theme)

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      The easiest way to test this is the places I found the problem whilst investigating MDL-61014 (but this does involve making some small changes to core forms):

      1. open course/moodleform_mod.php and replace hideIf with disabledIf for the line:

        $mform->hideIf('scale', 'assessed', 'eq', 0); 
        

      2. open lib/form/modgrade.php and replace all instances of hideIf with disabledIf for the line:
      3. Create a new forum instance in a course
      4. Whilst editing the forum instance settings, change Ratings > Aggregate type to 'No ratings'
        1. Confirm that the 'Scale' heading and all items below it disappeared
      5. 'Aggregate type' to any other setting
        1. Confirm that the 'Scale' heading, along with the items below it should appear
      6. With the 'Scale' section visible, change the 'Type' to 'None'
        1. Confirm that the 'Scale' + 'Maximum grade' items should be hidden
      7. Change 'Type' to 'Scale'.
        1. Confirm that the 'Scale' item should appear, the 'Maximum grade' item should be hidden
      8. Change 'Type' to 'Point'
        1. Confirm that the 'Scale' item should be hidden, the 'Maximum grade' item should appear
      9. Repeat all of the above with both theme_boost and theme_clean

      Note - with the scale/point settings the layout isn't perfect - there are extra br tags that act as separators which are not hidden in the process, but this looks better than having the 'Maximum grade' label stay visible, whilst the form item is hidden.

      Show
      The easiest way to test this is the places I found the problem whilst investigating MDL-61014 (but this does involve making some small changes to core forms): open course/moodleform_mod.php and replace hideIf with disabledIf for the line: $mform->hideIf('scale', 'assessed', 'eq', 0); open lib/form/modgrade.php and replace all instances of hideIf with disabledIf for the line: Create a new forum instance in a course Whilst editing the forum instance settings, change Ratings > Aggregate type to 'No ratings' Confirm that the 'Scale' heading and all items below it disappeared 'Aggregate type' to any other setting Confirm that the 'Scale' heading, along with the items below it should appear With the 'Scale' section visible, change the 'Type' to 'None' Confirm that the 'Scale' + 'Maximum grade' items should be hidden Change 'Type' to 'Scale'. Confirm that the 'Scale' item should appear, the 'Maximum grade' item should be hidden Change 'Type' to 'Point' Confirm that the 'Scale' item should be hidden, the 'Maximum grade' item should appear Repeat all of the above with both theme_boost and theme_clean Note - with the scale/point settings the layout isn't perfect - there are extra br tags that act as separators which are not hidden in the process, but this looks better than having the 'Maximum grade' label stay visible, whilst the form item is hidden.
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-61061_hideif_group

      Description

      If you apply the hideIf rule to the 'scale' element in a forum instance form (as I will be proposing to do via MDL-61014) and you are using the theme_clean then only the form elements are hidden, not the group itself (including the labels + titles).

      There is an additional problem when hideIf is used to hide the non-relevant 'scale' or 'maximum grade', when the grading type changes (e.g. hide the 'scale' select when the grading type is 'point' or 'none'). The form element is hidden, but the label is not.

      I will shortly attach a patch for both of these issues.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/Jan/18