Submit button to add +1 in form field
(EDITED to clarify question)
I have a group of radio buttons named KAQuestion.1 (export values are either 0 or 1), a Submit1 button, and two fields - CorrectTotal and IncorrectTotal.
If the radio value is 0, submit should trigger 1 to be added to IncorrectTotal
If the radio value is 1, submit should trigger 1 to be added to CorrectTotal
Please help me with the script for the Submit button. Here's the core of what I'm looking at:
var KAQ = this.getField("KAQuestion.1").value;
if (KAQ == 0)
this.getField("IncorrectAnswerTotal").value = +1;
else
this.getField("CorrectAnswerTotal").value = +1;
I had this script as a calculation on the CorrectTotal, which works, but I don't want the calculation to trigger until the user commits to the submit button
var testFor = "1";
var groups = this.getField("KAQuestion");
var ar = groups.getArray();
var cnt = 0;
for (var i=0; i<ar.length; i++) {
if (ar.value == testFor) {
cnt++;
}
}
event.value = cnt;
Thanks in advance.
