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

How do you change the color of a text field after text is entered in it?

New Here ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

I am creating a form with multiple text fields. Once a field is filled in, I would like the text field to change colors. I am having no luck getting that to happen. I've tried multiple ways. Any ideas on how to accomplish this? Thanks!

TOPICS
How to , PDF forms

Views

480

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 , Jan 25, 2021 Jan 25, 2021

As the custom calculation script of your field enter the following:

 

event.target.fillColor = (event.value==event.target.defaultValue) ? color.transparent : color.blue;

 

You didn't specify which colors you want to use, so I assumed transparent for the empty fields and blue for the filled-in ones...

Votes

Translate

Translate
Community Expert ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

As the custom calculation script of your field enter the following:

 

event.target.fillColor = (event.value==event.target.defaultValue) ? color.transparent : color.blue;

 

You didn't specify which colors you want to use, so I assumed transparent for the empty fields and blue for the filled-in ones...

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 Expert ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

You can also use the Validation event (with the same code) if your fields already have a calculated value.

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
New Here ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

LATEST

Thanks! They are currently clear and would want them to be blue. The fields would be a custom text field. That's the problem I am running into. I've tried different custom scripts but couldn't seem to get it correct. Coding isn't my thing 🙂

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