0
'If' statement on form syntax error
New Here
,
/t5/acrobat-discussions/if-statement-on-form-syntax-error/td-p/10871761
Jan 21, 2020
Jan 21, 2020
Copy link to clipboard
Copied
Hi guys,
I'm trying to write code for an 'if' statement on a form but I'm getting a syntax error and can't work out why. It's saying the error is on line 2... I'm new to this! Please help.
Basically I need the average of variable A and variable B calculating, but only if variable B is greater than variable A. If variable B is greater than variable A, use B. This is the code:
var A = this.getField("<Actual>").value + var B = this.getField("<Google Maps>").value /2;
if( B > A ) event.value = B;
else event.value = this.getField("<Value>").value;
TOPICS
PDF forms
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/acrobat-discussions/if-statement-on-form-syntax-error/m-p/10871767#M237395
Jan 21, 2020
Jan 21, 2020
Copy link to clipboard
Copied
Change this line:
var A = this.getField("<Actual>").value + var B = this.getField("<Google Maps>").value /2;
To:
var A = this.getField("<Actual>").value;
var B = this.getField("<Google Maps>").value/2;
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

