There are a number of conditions that will cause multichoice_validate to let improper values through.

For example, create a question, add two answer choices, and then select the correct checkbox in a later (empty answer) row. When you click Preview, the validation routine will think that there is a correct choice, and that empty row will show up in the preview pane, although that row isn't actually inserted into the table when you click Submit.

The following patch cleans up these problems, and adds a check for text in the feedback cell without a corresponding answer.

Comments

add1sun’s picture

Version: 6.x-2.x-dev » 5.x-1.x-dev

This should be addressed before a stable release so marking this for 5.x-1.x

kscheirer’s picture

StatusFileSize
new812 bytes

also, you can check "multiple answers" but select only 1 correct answer. This patch adds a test for that situation.

add1sun’s picture

Status: Needs review » Needs work

the original patch doesn't apply anymore so a new patch combining these will be need to be rolled. will get to that later today.

kscheirer’s picture

StatusFileSize
new2.28 KB

This is a combined patch of the above.

kthagen's original patch decided not to issue a warning if you marked an empty choice as correct, but I figured why not.
Also I didn't include the change to multichoice_render_question(), since thats covered here.

Also added periods at the end of some warnings, so they are all consistent.

kscheirer’s picture

Status: Needs work » Needs review
add1sun’s picture

Status: Needs review » Fixed

Thanks Karl! worked fine for me - added to 5 and HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)

  • Commit 821cb71 on 5.x-2.x, 6.x-2.x, 6.x-3.x, 6.x-4.x, 6.x-5.x, 6.x-6.x, 7.x-4.x, master, 7.x-5.x by add1sun:
    #103357 thanks to kscheirer. added validation to multichoice for empty...

  • Commit 821cb71 on 5.x-2.x, 6.x-2.x, 6.x-3.x, 6.x-4.x, 6.x-5.x, 6.x-6.x, 7.x-4.x, master, 7.x-5.x, quiz-pages by add1sun:
    #103357 thanks to kscheirer. added validation to multichoice for empty...

  • Commit 821cb71 on 5.x-2.x, 6.x-2.x, 6.x-3.x, 6.x-4.x, 6.x-5.x, 6.x-6.x, 7.x-4.x, master, 7.x-5.x, quiz-pages, 2269219 by add1sun:
    #103357 thanks to kscheirer. added validation to multichoice for empty...

  • Commit 821cb71 on 5.x-2.x, 6.x-2.x, 6.x-3.x, 6.x-4.x, 6.x-5.x, 6.x-6.x, 7.x-4.x, master, 7.x-5.x, 2269219 by add1sun:
    #103357 thanks to kscheirer. added validation to multichoice for empty...