Copy link to clipboard
Copied
Hello, I created a javascript to create a value of "yes" or "no" but the words are not populating. I am trying to write a scipt that if this text box "Supervision Minimum Face to Face Met 2" is >= 2 then Yes should populate otherwise No should populate. Here is my script
var nSubTotal = this.getField("Supervision Minimum Face to Face Met 2").value;
if( nSubTotal >= 2) event.value = yes;
else event.value = no;
Thank you.
It should be written like this, though:
event.value = (this.getField("Supervision Minimum Face to Face Met 2").value >= 2) ? "Yes" : "No";
Copy link to clipboard
Copied
Hi,
The values of yes and no are strings of texts.
They must be enclosed with quotes (i.e. "yes" , "no").
You may also simplify the script with a single line of code ( shown in the example below as a JavaScript ternary expression):
(this.getField("Supervision Minimum Face to Face Met 2").value >= 2) ? event.value = "Yes" :
event.value = "No";
Copy link to clipboard
Copied
It should be written like this, though:
event.value = (this.getField("Supervision Minimum Face to Face Met 2").value >= 2) ? "Yes" : "No";
Copy link to clipboard
Copied
My mistake.
Thank you for always keeping an eye!
Copy link to clipboard
Copied
Thank you both! This worked.
Copy link to clipboard
Copied
You're welcome.