Copy link to clipboard
Copied
I have a two page pdf form where the user puts a tick in the appropriate box. At the bottom of the form, the ticks in each column are added up. This sub-total (sub-total_1) is then multiplied by a specific number (column 1 is by 1, column 2 is by 2, column 3 is by 3 and column 4 is by 4) to give sub-total_2. Both sub-totals 1 and 2 are then added to give a final total for each column. All four column totals are then added to give a final figure. All of this works.
Based on the final total, I would like the form to automatically write:
Low if the total is between 0 and 20;
Moderate if the total is between 21 and 33;
High if the total is between 34 and 46;
Extreme if the total is 47 or more.
Is this possible and, if so, how do I do that?
I'm using Adobe Acrobat Pro DC, 2015
As the custom calculation script of the text field where you want to show the result, enter this code:
var total = Number(this.getField("Total").valueAsString);
if (total<=20) event.value = "Low";
else if (total<=33) event.value = "Moderate";
else if (total<=46) event.value = "High";
else event.value = "Extreme";
PS. The entire first paragraph of your question was not really necessary... It's better to keep things simple, to increase your chances of getting a reply.
Copy link to clipboard
Copied
As the custom calculation script of the text field where you want to show the result, enter this code:
var total = Number(this.getField("Total").valueAsString);
if (total<=20) event.value = "Low";
else if (total<=33) event.value = "Moderate";
else if (total<=46) event.value = "High";
else event.value = "Extreme";
PS. The entire first paragraph of your question was not really necessary... It's better to keep things simple, to increase your chances of getting a reply.
Copy link to clipboard
Copied
Thankyou for helping me. I entered your code as the custom calculation
script of the text field where I want to show the result and nothing
happened.
Copy link to clipboard
Copied
Check the JavaScript console for errors by pressing Ctrl+J.
Copy link to clipboard
Copied
Turns out I had an upper case letter where it should have been lower case! (in the field name)
Thankyou so much to both of you for helping me!