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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

      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.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            kabalin 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
            kabalin 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
            danmarsden Dan Marsden added a comment -

            Thanks Rosie/Ruslan

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

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

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

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

            Thanks guys, this has been integrated now.

            Certainly one of the big downsides to setType.

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

            This is working great.

            Thanks guys.

            Test passed.

            Show
            rwijaya Rossiani Wijaya added a comment - This is working great. Thanks guys. Test passed.
            Hide
            stronk7 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
            stronk7 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:
                  Fix Release Date:
                  9/Jan/12