Hi! I am writing a question using radio buttons where more than one possibility is correct. To further complicate things, the choices are images. I tried following the same approach here, which uses a popup instead, https://webwork.maa.org/moodle/mod/forum/discuss.php?d=3531, but it gives an error that 'one' is not defined in the context (code below).
My questions are:
- Is it possible to allow more than one answer to be counted as correct using radio buttons by fixing the code below?
- How would this change, if at all, if the radio button choices are images? (such as image("image.jpg", width=>"350"))
Note that I could probably work around Radio Buttons by assigning letters to the images and having students type in the correct letter(s), but I wanted to see if the above is possible.
Thanks so much in advance!
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"parserRadioButtons.pl",
"parserOneOf.pl",
);
TEXT(beginproblem());
COMMENT('');
Context("Numeric");
@choices = ("?","one", "two", "three");
$radio = RadioButtons([[@choices]], $choices[0]);
Context($radio->context);
BEGIN_PGML
What number is less than three?
[@ $radio->buttons @]*
END_PGML
ANS(OneOf(@choices[1,2])->cmp());
ENDDOCUMENT();