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

Changing Text Color Based On Value

Community Beginner ,
Feb 24, 2017 Feb 24, 2017

Hello!  I've got a drop down box with only 2 options - Pass or Fail.  I would like for Pass to be green when selected and Fail to be red.

I can't get any script to work for me.  

Anyone that can help me I would greatly appreciate it.

Thanks,

David

TOPICS
PDF forms
950
Translate
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 ,
Feb 24, 2017 Feb 24, 2017

You can change the fill color of the field based on the selection made in it, but it will affect all the items in it. You can't assign a unique color for each item in it.

Translate
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 ,
Feb 24, 2017 Feb 24, 2017

You can select a color for different items based off of a script.  I'm needing some help with creating a script.  Which was what I thought I made clear in the first post.

Translate
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 ,
Feb 24, 2017 Feb 24, 2017
LATEST

You can set the fill color for the field as a whole. It will look like this, though:

If that's OK with you, use this code as the field's custom validation script (and make sure to tick the option to commit the selected value immediately):

if (event.value=="Pass") event.target.fillColor = color.green;

else if (event.value=="Fail") event.target.fillColor = color.red;

else event.target.fillColor = color.white;

Translate
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