Copy link to clipboard
Copied
Hi,
Coding knowledge & experience non-existant so be gentle! An approximation of the form is attached for
I have pdf form that needs to auto display a text based on the number displayed in another form field. Box with the score is 'Total' (this box auto sums numbers from other form fields, which also autosums from other fields). Based on the range of score, the form field named 'AutoSignificance' needs to display the appropriate text.
Now, with a lot of googling and trial and error I got the following code to work. Except it doesn't auto update everytime the scoring in 'Total' changes. If I click into the box, type something and come out it updates with the correct text. I've tried to run the script by using actions for the form field (mouse up, exit etc.), which didn't work. This is also not ideal, as this field needs to be auto completed, users of the form not selecting this box is why this endeavour started in the first place!
Then I wanted to use Document Actions (Document did save) to run the script but I couldn't figure out how to reference the 'AutoSignificance' form field.
I'd take any help I can get here! The code I used in the 'AutoSignificance' form field is down below. Either:
1) A way to loop the code so that it runs based on the 'Total' changing or
2) a way to run the script when document is saved, in which case how do I reference the 'AutoSignificance' box in the script?
Code:
var v = this.getField("Total").value;
if (v=="") event.value = "Complete Scoring";
else {
if (v>=1 && v<=10) event.value = "Non-Significant";
else if (v>=11 && v<=13) event.value = "Apply Additional";
else if (v>=14 && v<=20) event.value = "Significant";
}
Copy link to clipboard
Copied
Use script as 'Custom calculation script' at 'calculate' tab.
In every dropdown field -> options tab, check 'Commit selected value immediately'.
Copy link to clipboard
Copied
Use script as 'Custom calculation script' at 'calculate' tab.
In every dropdown field -> options tab, check 'Commit selected value immediately'.
Copy link to clipboard
Copied
Well that was easy! Thank you very much 🙂
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more