hi! i’m creating a form in my app, and I wanted to count the radio button result each time one is chosen. for my usecase, my radio button has two values, “OK” and “NG” each time one of these values is chosen, I would like to show how many times it is chosen after the form is submitted. here is my code
(function() {
“use strict”;
var RADIOBUTTON = “inspect” //field code of dropdown field
var RADIO_VALUE1 = “OK”; //ok option
var RADIO_VALUE2 = “NG”; //ng option
var OKCOUNT = “okcnt”; //field code of ok qty
var NGCOUNT = ‘ngcnt’ //field code of ng qty
kintone.events.on([“app.record.create.show”, “app.record.edit.show”], function(showevent){
showevent.record[RESULT][‘disabled’] = true;
return showevent;
})
kintone.events.on([“app.record.create.submit”,“app.record.edit.submit”], function(submitevent){
var record = submitevent.record;
//var whatvalue = record[RADIOBUTTON].value;
if (record[RADIOBUTTON.value] === RADIO_VALUE1){
record[OKCOUNT].value += 1;
}
else(record[RADIOBUTTON.value] === RADIO_VALUE2){
record[NGCOUNT] += 1;
}
return submitevent;
});
})();
pls help me if there is something wrong in my code.
thanks a lot!