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

Regression in formslib: "neq" condition no longer working on radio buttons.

    XMLWordPrintable

Details

    • MOODLE_34_STABLE
    • MOODLE_34_STABLE
    • MDL-60012_form_neq_regression
    • Hide
      • Place the attached 'formneqtestpage.php' script in the root directory of your test site
      • Visit [site]/formneqtestpage.php
      • Click on the radio buttons
      • Ensure that the text fields are disabled as expected when you select the different radio buttons

      Note that the fact that neither textbox is disabled when neither radio button is selected is outside the scope of this ticket - possibly 'neq' should activate when no radio button is selected, but this patch fixes the behaviour back to how it was before the regression.

      Show
      Place the attached 'formneqtestpage.php' script in the root directory of your test site Visit [site] /formneqtestpage.php Click on the radio buttons Ensure that the text fields are disabled as expected when you select the different radio buttons Note that the fact that neither textbox is disabled when neither radio button is selected is outside the scope of this ticket - possibly 'neq' should activate when no radio button is selected, but this patch fixes the behaviour back to how it was before the regression.

    Description

      Noticed in the attendance plugin when running behat on master - not an issue on stable versions - seems to be a regression caused by MDL-53848

      the condition "neq" on radio button selector doesn't seem to work anymore.

      $mform->disabledIf('groups', 'sessiontype', 'neq', mod_attendance_structure::SESSION_GROUP);
      

      The "groups" selector is always disabled no matter what the radio button "sessiontype" is set to.

      replacing it with an "eq" instead of a "neq" seems to work better:

      $mform->disabledIf('groups', 'sessiontype', 'eq', mod_attendance_structure::SESSION_GROUP);
      

      here's the example in the Attendance code (on a form when adding a new session and the course/module are set to allow groups.)
      https://github.com/danmarsden/moodle-mod_attendance/blob/6d812f5ea9b8f2fbc0aef679d1a613b205e0ec1b/add_form.php#L96

      Attachments

        Issue Links

          Activity

            People

              davosmith Davo Smith
              danmarsden Dan Marsden
              Marina Glancy Marina Glancy
              Andrew Lyons Andrew Lyons
              Mark Nelson Mark Nelson
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/Nov/17