Skip to main content
Participant
September 9, 2018
Question

Java Script Issue: auto populate "Yes or No" Value.

  • September 9, 2018
  • 1 reply
  • 359 views

I am trying to create a java script to auto populate a yes or no value in one field based on a value in another field. I tried the following script, but it did not work:

if(Depth To Water ft2 <= 20.20) {     Submerged YN2 = "Yes"; } else {     Submerged YN2 = "No"; }

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
September 9, 2018

Use this code as the custom calculation script of "Submerged YN2":

var v = Number(this.getField("Depth To Water ft2").valueAsString);

event.value = (v<=20.20) ? "Yes" : "No";

Edit: fixed the code a bit...