Copy link to clipboard
Copied
I have options A, B, C, D, E and others. Depending on what I check, I want to list the corresponding values in the Risk field - if there is more than one, separated by commas. See attachment. Can you help me, please?
You can use this code as the custom calculation script of the "risks" field:
(Edit: code fixed)
var risks = [];
for (var i=1; i<=5; i++) {
var v = this.getField("risk" + i).valueAsString;
if (v!="Off") risks.push(v);
}
if (this.getField("risk6").valueAsString!="Off") risks.push(this.getField("other").valueAsString);
event.value = risks.join(", ");
Copy link to clipboard
Copied
What are the names of the check-boxes and text field (for the "Other" value)?
Copy link to clipboard
Copied
Sorry, didn't notice your file had fields... I will post the code in a moment.
Copy link to clipboard
Copied
You can use this code as the custom calculation script of the "risks" field:
(Edit: code fixed)
var risks = [];
for (var i=1; i<=5; i++) {
var v = this.getField("risk" + i).valueAsString;
if (v!="Off") risks.push(v);
}
if (this.getField("risk6").valueAsString!="Off") risks.push(this.getField("other").valueAsString);
event.value = risks.join(", ");
Copy link to clipboard
Copied
This will give error.
Copy link to clipboard
Copied
Thanks a lot! It works perfectly! I must only add code
var v = this.getField("risk" + i).value;
Copy link to clipboard
Copied
Yeah, sorry. Don't know what happened there... I fixed it now.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more