Moodle
  1. Moodle
  2. MDL-30536

Choice module responses limit in numeric only works with javascript enable.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.6, 2.1.3, 2.2
    • Fix Version/s: 2.0.7, 2.1.4, 2.2.1
    • Component/s: Choice
    • Labels:
    • Testing Instructions:
      Hide

      Disable JS
      Create a new Choice, enable the limit and enter non-numeric values in the limit field
      save form - make sure validation rule kicks in and prevents save.

      Show
      Disable JS Create a new Choice, enable the limit and enter non-numeric values in the limit field save form - make sure validation rule kicks in and prevents save.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      master_MDL-30536
    • Rank:
      33250

      Description

      Notice this issue while testing MDL-30526.

      Numeric validation only works with javascript enable.

      With javascript disable, the form can be submitted and set the non-numberic input to 0.

        Issue Links

          Activity

          Hide
          Ruslan Kabalin added a comment - - edited

          This is because in mod/choice/mod_form.php we have

          $mform->setType('limit', PARAM_INT);
          

          So, the variable is turned into integer upon submission and passes 'numeric' rule. Not sure about the best solution. If numeric rule is a suitable replacement of PARAM_INT, then we may remove the latter.

          Show
          Ruslan Kabalin added a comment - - edited This is because in mod/choice/mod_form.php we have $mform->setType('limit', PARAM_INT); So, the variable is turned into integer upon submission and passes 'numeric' rule. Not sure about the best solution. If numeric rule is a suitable replacement of PARAM_INT, then we may remove the latter.
          Hide
          Dan Marsden added a comment -

          Thanks Rosie/Ruslan

          NOTE TO INTEGRATOR: please cherry-pick onto 20_STABLE and 21_STABLE branches.

          Show
          Dan Marsden added a comment - Thanks Rosie/Ruslan NOTE TO INTEGRATOR: please cherry-pick onto 20_STABLE and 21_STABLE branches.
          Hide
          Michael de Raadt added a comment -

          Just placing this on the stable backlog until it is resolved.

          Show
          Michael de Raadt added a comment - Just placing this on the stable backlog until it is resolved.
          Hide
          Sam Hemelryk added a comment -

          Thanks guys, this has been integrated now.

          Certainly one of the big downsides to setType.

          Show
          Sam Hemelryk added a comment - Thanks guys, this has been integrated now. Certainly one of the big downsides to setType.
          Hide
          Rossiani Wijaya added a comment -

          This is working great.

          Thanks guys.

          Test passed.

          Show
          Rossiani Wijaya added a comment - This is working great. Thanks guys. Test passed.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Yes, you did it!

          Now your code is part of the best weeklies released ever, many thanks!

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Yes, you did it! Now your code is part of the best weeklies released ever, many thanks! Closing, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: