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

Validation errors not displayed for grouped fields

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.9.8, 2.0.5, 2.1.2, 2.2
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide

      As in the description.

      Show
      As in the description.
    • Workaround:
      Hide

      If you add the validation error to the group, that is

      $errors['groupname'] = 'Ha! I won\'t let you submit the form.';

      rather than to the field inside the group

      $errors['fieldname'] = 'Ha! I won\'t let you submit the form.';

      then the error displays. You can see this in the attached testgroupvalidation.php file, if you change which line in the validation function there is commented out.

      Show
      If you add the validation error to the group, that is $errors ['groupname'] = 'Ha! I won\'t let you submit the form.'; rather than to the field inside the group $errors ['fieldname'] = 'Ha! I won\'t let you submit the form.'; then the error displays. You can see this in the attached testgroupvalidation.php file, if you change which line in the validation function there is commented out.
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE

      Description

      See the attached test script testgroupvalidation.php. Save that into the top level of your Moodle install, then go there in your browser.

      Try to submit the form. You cannot, because the validation is hard-coded to fail. However, the validation error is not displayed, so it is impossible to know why you are not allowed to submit the form.

      The validation error should be displayed.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: