Call Us At: 701.866.2098

Acro Javascript: Placement Text in PDF Form Fields


In addition to the post: Acro Javascript: Question Icons / Buttons an additional way to include instruction to users who may have questions when filling out more complex forms is to use placement text within the form fields.

Here’s how the PDF could function:
Placement Text in PDF Form Fields

To do this, start by opening a PDF form. Select the Prepare Form tool to edit the PDF form fields.
Edit PDF Tool

Right-click on the form field to put the placement text on and select Properties. Click on the Options tab and enter the Default Value for the form field.

Default text value Acrobat form field

Select the Actions tab, this is where the code gets placed for both On Focus and On Blur.

PDF Placement Text Form Fields

Here’s the Acro-JavaScript used:
On Focus

if (event.target.value==event.target.defaultValue) {
event.target.value = "";
event.target.textColor = color.black;
}

OnBlur

if (event.target.value=="") {
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
}

Leave a comment

Your email address will not be published. Required fields are marked *