Field numerical change based on other field.

Community Beginner ,
May 27, 2020 May 27, 2020

Copy link to clipboard

Copied

Hi There,

I was wondering if anyone could help me generate a code for a problem I have in Acrobat. I have two fields, one which will have a user entered number and another which will display a different number based on the user input. 

 

For example: The user inputs (16) into their field and the second field would populate (3). Likewise, if the user inputted (8) the second field would display (-1).

 

This was this code I've been working on but I cannot seem to get it right. Any thoughts?

 

switch(event.value) {

 

case "SCORE":

var nSubTotal = this.getField("subtotal").value;
if( nSubTotal > 28 ) event.value = 9;
else if( nSubTotal > 26 ) event.value = 8;
else if( nSubTotal > 24 ) event.value = 7;
else if( nSubTotal > 22 ) event.value = 6;
else if( nSubTotal > 20 ) event.value = 5;
else if( nSubTotal > 18 ) event.value = 4;
else if( nSubTotal > 16 ) event.value = 3;
else if( nSubTotal > 14 ) event.value = 2;
else if( nSubTotal > 12 ) event.value = 1;
else if( nSubTotal > 10 ) event.value = 0;
else if( nSubTotal > 8 ) event.value = -1;
else if( nSubTotal > 6 ) event.value = -2;
else if( nSubTotal > 4 ) event.value = -3;
else if( nSubTotal > 2 ) event.value = -4;

}

TOPICS
Acrobat SDK and JavaScript, Edit and convert PDFs, PDF forms

Views

185

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 27, 2020 May 27, 2020

Copy link to clipboard

Copied

LATEST

I ended up finding a solution.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines