WeBWorK Main Forum

Help links in Gateway Quizzes

Help links in Gateway Quizzes

by Sean Fitzpatrick -
Number of replies: 3
I just noticed that help links (like help(numbers)) do not work in Gateway Quizzes.
If I view a problem in an assignment or the homework set editor, the help links work as expected, with the help page popping up.

In a quiz, clicking on a help link just jumps you to the top of the page.

Is this a known issue? Are there workarounds?
In reply to Sean Fitzpatrick

Re: Help links in Gateway Quizzes

by Gavin LaRose -

Here's my guess as to what is happening, and a possible workaround. The help(keyword) syntax is coming from AnswerFormatHelp.pl, which works by embedding a javascript function in the rendered problem that opens the help window on a click on the help text. In a gateway assignment, the problem isn't being rendered the same way (in particular, because there are several problems that are being rendered in the same gateway assignment page, there the header material probably gets discarded).

Possible workaround: embed the desired function in the problem explicitly. This means that we'd be redefining it if the problem is used in a regular problem set, but that shouldn't be an issue. To this we have to get into the rendering of the HTML for the problem; the following is an outline of what I think should work.

[problem header]
<script type="text/javascript">
function openhelpUnits() {
if (window.focus) {OpenWindow.focus()}
return false;


$linkText = TEXT(MODES(TeX=>'help(units)',HTML=>'<a href="#" onclick="return openhelpUnits();">help(units)</a>'));

[etc] $linkText

Here the [problem header] information is whatever is in the problem header, up to where we're rendering the problem. I've copied the text of the javascript function (here, openhelpUnits, for help on units) from the macro file pg/macros/FortLewis/AnswerFormatHelp.pl.

For what it's worth,

In reply to Gavin LaRose

Re: Help links in Gateway Quizzes

by Sean Fitzpatrick -
Thanks for this. We'll experiment and see how this works.
In reply to Sean Fitzpatrick

Re: Help links in Gateway Quizzes

by Gavin LaRose -

...Oops. Just noticed that I dropped the ending </script> tag from the end of the "here" text defined by <<EOT...EOT.

But you saw that where I didn't, I am sure.