replied on December 1, 2016
Haylee,
I am using Laserfiche forms for our ISO Preparedness evaluations. This is a form with several multiple choice questions (Radio buttons) to ensure our employees are well-trained in ISO processes/procedures. Not sure if this is exactly what you're looking for, but figured it might get you started on the right track.
I've included a brief example of my code and form below. If you have further questions, feel free to reach out to me via email (barkern@protrans.com)
Form:

Javascript:
//Qeustion 1
$('input:radio[name=Field8]').change(function (e) {
if(this.checked && this.value == 'c') {
correctAnswers++;
}
});
//Question 2
$('input:radio[name=Field9]').change(function (e) {
if(this.checked && this.value == 'd') {
correctAnswers++;
}
});
$('.Submit').on('click', function (e) {
//variables with global implications
var totalQuestions = 31;
var alertText;
var i;
if(correctAnswers == totalQuestions) {
alertText = "Congratulations! You got all the questions right!";
$('#q42 input').val(correctAnswers);
}
else {
$('#q42 input').val(correctAnswers);
alertText = "You got " + correctAnswers + " out of " + totalQuestions + " correct!";
}
alert(alertText);
});
Note: as you can see I created a function event for each question. I'm sure a more experienced Javascripter can come up with a better way to consolidate this code using an array and/or For Each loop. This works for my purposes. Also, make sure that you use the 'Assign values to choices' checkbox within the radio button itself. See below:
