Copy link to clipboard
Copied
Hi all,
I am wondering if it is possible to add some script, that would allow reference to a Radio Button Group (called "Operatortimesingle1") that have Choices 1 & 2. I have a field ("Totaltime1") in which I have the following script (see below).
What I am thinking - is it possible to have reference to the "Operatortimesingle1" Radio Button Group in the script shown, that allows for the value of "0:00" to be true, if either of the Choices (1 or 2) are not selected, i.e. no Radio Button Choice is made (empty) - but vice versa - if either Radio Button Choice (1 or 2) is selected, the value as calculated by the script below, is then present?.
Script in field "Totaltime1";
var aFields = new Array("Timesingle1", "Timesingle2", "Timesingle3", "Timesingle4", "Timesingle5", "Timesingle6", "Timesingle7", "Timesingle8", "Timesingle9", "Timesingle10");
var nSum = 0;
var sTime;
for(i = 0; i < aFields.length; i++) {
sTime = this.getField(aFields[i]).valueAsString;
if(sTime == "") sTime = "00:00";
nSum += HHMM2Min(sTime);
}
event.value = Min2HHMM(nSum);
function Min2HHMM(nMinutes) {
var s = util.printf("%,001.0f:%,202.0f", Math.floor(nMinutes / 60), nMinutes % 60);
return s;
}
Sure. Change this line:
event.value = Min2HHMM(nSum);
To:
event.value = this.getField("Operatortimesingle1").valueAsString=="Off" ? "0:00" : Min2HHMM(nSum);
Copy link to clipboard
Copied
Sure. Change this line:
event.value = Min2HHMM(nSum);
To:
event.value = this.getField("Operatortimesingle1").valueAsString=="Off" ? "0:00" : Min2HHMM(nSum);
Copy link to clipboard
Copied
Hi Try67,
Many thanks as always! spot on! 😉