• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

How can I get the font colour in a text box to change when I start typing?

Community Beginner ,
Apr 11, 2024 Apr 11, 2024

Copy link to clipboard

Copied

So I have a text box that has a default value displayed and I have made the font grey, so that when it is printed, you can write over the top of the default value easily to fill it in by hand. Aside from being a printable form to be filled in by hand, I also want to be able to fill in the form electronically, however, when I type into the text box and the default value disappears (I have used a JavaScript format for that, see below) the text that is typed into the box is still grey, I want the text to turn black when I begin typing into the field. How can I do this? I'm thinking probably an addition to the JavaScript, but my grasp of it is very limited.

 

The JavaScript format I have used is:

 

if (event.value == "") {
        event.target.display = display.visible;
        event.value = 'DDMMYY';
    }

TOPICS
Edit and convert PDFs , How to , Modern Acrobat , PDF forms , Windows

Views

123

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

correct answers 1 Correct answer

Community Expert , Apr 11, 2024 Apr 11, 2024

You will need to use the On Focus event for this. Here's an example:

event.target.textColor = color.black;

 

PS. In the future you should post under the Acrobat forum if you have questions about creating form fields and using scripts. The Reader forum is about viewing PDF files in Reader.

Votes

Translate

Translate
Community Expert ,
Apr 11, 2024 Apr 11, 2024

Copy link to clipboard

Copied

You will need to use the On Focus event for this. Here's an example:

event.target.textColor = color.black;

 

PS. In the future you should post under the Acrobat forum if you have questions about creating form fields and using scripts. The Reader forum is about viewing PDF files in Reader.

Votes

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
Community Beginner ,
Apr 11, 2024 Apr 11, 2024

Copy link to clipboard

Copied

LATEST

Excellent, thank you!

Votes

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