Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Javascript for Acrobat form field instructions

Community Beginner ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

I'm trying to add instructional text to my form fields in Acrobat Pro DC. I found these two helpful resources that allowed me to set up the code:

  1. https://answers.acrobatusers.com/How-create-disappearing-instruction-text-fields-q303265.aspx
  2. https://www.youtube.com/watch?v=F1VwOMTlI3Q 

 

Now I'm trying to figure out how to set the specific font and size for that instructional text. My current script is:

 

if(event.value=="")

{ event.value="Instructional text goes here..."; font.size = "10pt"; }

 

That results in the following:

Screen Shot 2021-06-09 at 4.26.28 PM.png

 

 

 

 

Now I just need to change the font and size so it fits better. What script/code can I add? Can anyone help?

This is the best way to put the "Instructional text to a fillable text field" using scripting in adobe acrobat dc that will disappear when the user clicks th...
TOPICS
PDF forms

Views

250

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
Adobe Community Professional ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

This code is incorrect:

font.size = "10pt";

Use this, instead:

event.target.textSize = 10;

And to set the font you need to know the internal name of it, and then apply it to the textFont property, like this:

event.target.textFont = "Arial";

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
Adobe Community Professional ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

LATEST

See this article and watch the vidoes:

https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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