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

Cannot enter an answer of zero in a multiple choice question

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.5
    • Fix Version/s: 2.2.6, 2.3.3
    • Component/s: Questions
    • Labels:
      None
    • Testing Instructions:
      Hide

      1. Turn on the HTML editor in your user profile. (After that you have done that, you will have to log out and log in again for it to take effect. That is probably a bug, but an unrelated one.)

      2. Go to the question bank, and create a multiple choice question with choices 1, 0 and -1, with 0 the right choice. Make sure you can save the form.

      Show
      1. Turn on the HTML editor in your user profile. (After that you have done that, you will have to log out and log in again for it to take effect. That is probably a bug, but an unrelated one.) 2. Go to the question bank, and create a multiple choice question with choices 1, 0 and -1, with 0 the right choice. Make sure you can save the form.
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      If you try to use the number 0 as an answer in a multiple-choice question, Moodle will not accept it. Looks like misuse of a comparison operator in the code.

      Steps to reproduce
      ==================
      1. Create a new multiple-choice question. Give it a name and question text.
      2. Insert answers: 2, 1, 0, -1
      3. Insert 100% grade for one of them
      4. Save changes

      Expected result
      ===============
      Question should be created successfully.

      Actual result
      =============
      Moodle returns to the form, and the answer 0 has an error message: "Grade set, but the Answer is blank"

        Attachments

          Activity

            People

            Assignee:
            timhunt Tim Hunt
            Reporter:
            daveyboond Steve Bond
            Integrator:
            Sam Hemelryk
            Tester:
            Ankit Agarwal
            Participants:
            Component watchers:
            Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              12/Nov/12