I am using R/exams in combination with Quarto to create embedded web quizzes in HTML documents. Following the official exams2forms tutorial I had set up lecture exercises successfully. However, after updating the exercises, using the packages exams
2.4-2 and exams2forms
0.2-1, the "Check answer" button ✔️ does not work anymore. The answers are not flagged as correct or incorrect and the corresponding color highlighting is missing. I have checked browsers Firefox, Safari, and Brave.
I am using code similar to the demo from the tutorial above, e.g.,
---
format:
html:
embed-resources: true
css: webex.css
include-after-body: webex.js
---
```{r}
#| label: quiz2
#| echo: false
#| message: false
#| results: "asis"
#| warning: false
library(exams2forms)
exm <- list(c("swisscapital.Rmd"))
exams2forms(exm, n = 20)
```
At first, I assumed it was an issue with my local setup, but I then noticed the same behavior on the official tutorial page. So I think that there might be a bug in the software?
.Rmd
files, no longer do.TL;DR The webex.js
and webex.css
files need to be in sync with the version of the exams2forms()
output.
exams2forms()
output (from version 0.2-x) but old webex
files (from version 0.1-0). Hence these new exercises do not work while the old ones continue to work.webex
files but old exams2forms()
output in the tutorial (which I had overlooked when updating all the exercise template pages).Recommended fix: Re-generate all exams2forms()
output with the latest version and update the webex
files using the files shipped with the same version of the package. (We will try to make the latter step a bit easier in future versions of the package.)
Background: From version 0.1-0 to version 0.2-0 of the exams2forms
package, some additional features were added that necessitated substantial changes/additions in the Javascript and CSS files. In particular, the basic obfuscation of the solutions, the auto-display of filled-in exercises, and the support of certain regular expressions required changes that are not fully backward compatible. For some more details see: https://www.R-exams.org/general/cran_release_242/#interactive-web-exercises-via-exams2forms