Skip to main content
September 19, 2016
Question

Can javascript be used to grade a multiple choice PDF test?

  • September 19, 2016
  • 2 replies
  • 299 views

I'm curious to see if Javascript can be used to grade a multiple choice test automatically with a submit button. Something like comparing the correct answers to an answer key then saving the file with the name and number of questions correct. Or perhaps saving the file with a text field at the bottom with the number of correct answers. I already know how to save with a custom name from a submit button. So all I would need would be the auto grade function if at all possible.

This topic has been closed for replies.

2 replies

Inspiring
September 19, 2016

Yes, D.P. Story has developed a whole system around LaTex and Acortex to develop mathematical lessons and tests.

Karl Heinz  Kremer
Community Expert
Community Expert
September 19, 2016

That's certainly possible, but you would have to provide the functionality to check the given answers agains your answer key. If you use a good naming convention for your radio button groups, you can access e.g. the given answer for question 1 using the following:

var a1 = this.getField("Question1").value;

You can then test this value agains your answer key and keep track of how many correct/incorrect answers you have in this particular test. You can then e.g. unhide a so far hidden field and add information about this number and the grade to that field.