Copy link to clipboard
Copied
I need some very basic help on filling a text field based upon the numeric value of another field. The form I am developing is the Adobe Acrobat Pro version of an assistive technology assessment and planning instrument for students with severe developmental and physical disabilities. My team and I originally published it in hardcopy format in the 1980’s. The form contains 56 rating items that yield numeric values 0 to 10. For each of those values there is a line of specific text that needs to be placed in a specific field on the Results and Implications pages of the pdf. Will someone please provide me with an example of how to accomplish this?
Copy link to clipboard
Copied
Let's say ratings field is named "Rating1" use this as custom calculation script of the field where you wish to show text:
var rating = Number(this.getField("Rating1").valueAsString);
if(rating === 1)
event.value = "Text for rate 1";
else if(rating === 2)
event.value = "Text for rate 2";
else if(rating === 3)
event.value = "Text for rate 3";
//continue for rest of the ratings
else
event.value = "";
This is some basic script to do it, since you have a lot of fields if they are named correctly you could use loop to go over all fields with only one script.
Copy link to clipboard
Copied
Thank you for your response. This is going to give you a clue to how new I am to trying to build this form with Acrobat. When I am in "Prepare a Form" can I enter this script into the "Custom calculation script:" box associated with "text field properties." for the text field?
Copy link to clipboard
Copied
Yes.
Copy link to clipboard
Copied
Enter a custom calulation in the text field where you want to display the result:
if(this.getField("Name of Numberic Value Field").value==5)
{event.value="The result when the field equals 5"}
Copy link to clipboard
Copied
Thank you for your response. Would I have to repeat this script/code 11 times for each text field? There are 11 possible specific strings of text for each field on the Results page.
Copy link to clipboard
Copied
var fldValue=this.getField("Name of Numberic Value Field").value;
if(fldValue==0)
{event.value="The result when the field equals 0"}
else if(fldValue.value==1)
{event.value="The result when the field equals 1"}
else if
...continue until 10th instance.
Copy link to clipboard
Copied
Thank You! I'll let you know how it goes. Thank you!