Jump to: Site Navigation



Provides free response, fill in the blank questions with interactive help. As a student types their answer into the answer blank, jQuery's autocomplete feature generates a drop-down list of allowable answers that match what has already been typed. When the student presses the "Check Answers" or "Submit Answers" button, jQuery generates a warning message if the student answer is not one of the allowable answers. Choices in the drop-down list and the correct answer are specified by the problem author. WordCompletion objects are compatible with Value objects, and in particular, can be used with MultiAnswer objects.

To create a WordCompletion object, use

        $w = WordCompletion([choices,...],correct);

where "choices" are the strings for the allowable answers in the drop-down list and "correct" is the correct answer from the list.

To insert the WordCompletion into the problem text, use

        \{ $w->ans_rule(40) \}

You can explicitly list all of the choices using

        \{ $w->choices_text \}

for a comma separated list of the choices (inline, text style) and

        \{ $w->choices_list \}

for an unordered list (display style). Use

        ANS( $wb->cmp );

to get the answer checker for the WordCompletion object. Note: the way to construct and use WordCompletion objects is exactly the same as PopUp objects (see, and you can use menu instead of ans_rule.

You can use the WordCompletion object in MultiAnswer objects. This is the reason for the WordCompletion's ans_rule method (since that is what MultiAnswer calls to get answer rules).


Paul Pearson (Hope College Mathematics Department)

(Davide Cervone wrote, which served as a template for

Site Navigation