1

I've made a fillable multiple-choice test to send out for assessments on ships without reliable net connections. The questions each have three options, generally with radio buttons and a single correct answer (one question has checkboxes instead with two correct options).

Questions with radio buttons

As things stand, the answers can be checked manually. I would prefer to automate the checking process, marking correct answers on the answer sheet with a green tick (and incorrect answers with a red X, presumably using Wingdings for simplicity?) and displaying a message to proceed to the certificate when they get 100% correct.

Answer sheet with cells showing correct answer

I'm not at all familiar with coding in Acrobat forms. Is there a relatively easy way of accomplishing this?

1 Answers1

1

You'll need to use Javascript to do this. I'll put here a stub, as a complete answer would require extensive coding, and is off-topic here.

The code goes into each field's "custom validation script".

To check whether the correct checkbox is checked, for each field in your verification table, you'll need to insert an if.. else.. statement (copied from this answer on stackoverflow)

if (this.getField("myCheckBox").value != "Off") { 
   // the box is checked 
   // do what should be done when the box is checked 
} else { 
   // the box is not checked 
   // do what should be done when the box is not checked 
}

To set the color of your field, according to this post you need the code:

event.target.fillColor = color.green;

So, in total, this would become something like:

if (this.getField("myCheckBox").value != "Off") { 
   // the box is checked 
   event.target.fillColor = color.green;
} else { 
   // the box is not checked 
   event.target.fillColor = color.red;
}

where myCheckBox is the name of the checkbox for the correct answer.

I have not validated this code, as this should be done by you. If you need further help for your code, ask a question on the stack overflow community

1NN
  • 10,044