Simple Popup

Answers are lists of points

Complete Code

Download file: SimplePopUp.pg

POD for Macro Files

PG problem file

Explanation

DOCUMENT();

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

Preamble

Load parserPopUp.pl for pop up (or drop down) menu answers.

$popup = PopUp([ '?', 'one', 'two', 'three' ], 'three');

$dropdown1 = DropDown([ 'one', 'two', 'three' ], 'two');
$dropdown2 = DropDown([ 'one', 'two', 'three' ],
    'one', placeholder => 'Select an option');
$dropdown3 =
    DropDown([ 'one', [ 'two', 'three', 'four', 'five' ], 'six' ], 'six');

$tf = DropDownTF('T');

Setup

This shows a number of ways to use either PopUp (the legacy version) or DropDown (a more flexible version). Both create an HTML select object. The PopUp takes a array reference of options and the correct answer and creates the options. Notice in Popup the first element is shown, but selectable, whereas in DropDown, the first either defaults to ? or whatever is set in the placeholder option. In Dropdown, the first element is not selectable.

Similar to other parser objects, inserting another array reference, randomizes those options.

Lastly, the DropDownTF creates a true/false dropdown.

BEGIN_PGML
- [_]{$popup} (Answer: 'three')

- [_]{$dropdown1} (Answer: 'two')

- [_]{$dropdown2} (Answer: 'one')

- [_]{$dropdown3} (Answer: 'six')

- [_]{$tf} (Answer: 'True')
END_PGML

Statement

This is the problem statement in PGML.
BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

COMMENT('MathObject version. Uses PGML.');

ENDDOCUMENT();

Solution

A solution should be provided here.