Copy link to clipboard
Copied
Hi there,
Is it possible to click checkboxes and get the value to appear in a text field?
Checkbox values are:
Level Life
Increasing Life
Decreasing Life
Level CI_CILC
The name of the Text Field is "TextField1".
If possible I would like to try and get the textfield populated, if all 4 checkboxes are active, as:
'Level Life | Increasing Life | Decreasing Life | Level CI_CILC '
Any help would be greatly appreciated
Steve
Copy link to clipboard
Copied
You can do it using this code, as the custom calculation script of the text field:
var values = [];
if (this.getField("Check Box 5").valueAsString!="Off") values.push("Level Life");
if (this.getField("Check Box 6").valueAsString!="Off") values.push("Increasing Life");
if (this.getField("Check Box 7").valueAsString!="Off") values.push("Decreasing Life");
if (this.getField("Check Box 8").valueAsString!="Off") values.push("Level CI_CILC");
event.value = values.join(" | ");
Copy link to clipboard
Copied
You can do it using this code, as the custom calculation script of the text field:
var values = [];
if (this.getField("Check Box 5").valueAsString!="Off") values.push("Level Life");
if (this.getField("Check Box 6").valueAsString!="Off") values.push("Increasing Life");
if (this.getField("Check Box 7").valueAsString!="Off") values.push("Decreasing Life");
if (this.getField("Check Box 8").valueAsString!="Off") values.push("Level CI_CILC");
event.value = values.join(" | ");
Copy link to clipboard
Copied
Brilliant. Many thanks,
Steve
Copy link to clipboard
Copied
If you wish to show values when all 4 checkboxes are active, use this as custom calculation script of text field:
var checkedValues = [];
for (var i=5; i<=8; i++) {
var f = this.getField("Check Box " + i).valueAsString;
if (f !== "Off") {
checkedValues.push(f);}}
if (checkedValues.length === 4) {
event.value = checkedValues.join(" | ");}
else {
event.value = "";}