WeBWorK Main Forum

Easiest way to have string answers with PGML? Need some examples.

Re: Easiest way to have string answers with PGML? Need some examples.

by Davide Cervone -
Number of replies: 0
Here is an example that uses a popup menu. You have to create the PopUp() before the BEGIN_PGML/END_PGML block in order for it to work.
    DOCUMENT();

    loadMacros(
      "PGstandard.pl",
      "PGML.pl",
      "MathObjects.pl",
      "parserPopUp.pl",
      "PGcourse.pl",
    );
 
    TEXT(beginproblem());
    
    $popup = PopUp(["increases","decreases","stays the same"],"increases");    
        
    BEGIN_PGML
    What happens to the pressure if the number of atoms is increased while keeping
    everything else the same? [____________]{$popup}
    END_PGML

    ENDDOCUMENT();
You can do something similar for radio buttons using parserRadioButtons.pl.

Davide