Skip to main content
Participant
January 25, 2021
解決済み

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

  • January 25, 2021
  • 返信数 1.
  • 1119 ビュー

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!

このトピックへの返信は締め切られました。
解決に役立った回答 try67

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...

返信数 1

try67
Community Expert
try67Community Expert解決!
Community Expert
January 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...

Participant
January 25, 2021

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 🙂