WeBWorK Problems

Subsequent Question Content Affected by Previous Answer

Subsequent Question Content Affected by Previous Answer

by Kyle Schlitt -
Number of replies: 2

Is it possible to, depending on a student's answer to a pop up, change the way the rest of the question is rendered?

For example, the following question prints two matrices and expects the student to determine whether their product is defined.  Since the answer in this case is yes, once they correctly answer the question, I'd like to ask them also to specify the dimensions of the product.  In order to not sway their answer, ideally I'd like ask them for the dimensions only if they have concluded that the product is defined.

DOCUMENT();

loadMacros(
  'PGstandard.pl',
  'PGML.pl',
  'MathObjects.pl',
  'parserPopUp.pl'
);

$A = Matrix([[1,2,3,4],[1,2,3,4],[1,2,3,4]]);
$B = Matrix([[1,2],[1,2],[1,2],[1,2]]);

$popup = DropDown(
  ["undefined", "defined"],
  "defined",
  placeholder => 'Select one'
);

BEGIN_PGML

[`[$A][$B]`] is [_]{$popup}.

END_PGML

ENDDOCUMENT();
In reply to Kyle Schlitt

Re: Subsequent Question Content Affected by Previous Answer

by Glenn Rice -
It may be possible to do what you are asking, but doing so will undoubtedly require quite a bit of hacking.  So instead I suggest the approach using the parserRadioMultiAnswer.pl macro in the attached file.

In reply to Glenn Rice

Re: Subsequent Question Content Affected by Previous Answer

by Kyle Schlitt -

Thanks Glenn.  I thought it might be a bit of a stretch!