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

Dropdown box selection to change background color of a different text field

New Here ,
Jun 17, 2021 Jun 17, 2021

Hello!

I have a client who likes to highlight rows on his to do list based on a certain type of task. Each type of task is a different color.

 

I would like to be able to create a dropdown with different color names in it and when a color is chosen, that row is highlighted in that color. I know how to do it with a button in the Indesign interactive PDF, but that makes the pdf too cluttered. My google-fu is failing me on how to do it with a dropdown list instead.

 

I have added a screenshot to show you what I have so far with the buttons.

I have the most recent version of Adobe Acrobat Pro.

 

I found this post on the forums but it doesn't explain how to change the color of a DIFFERENT field. Capture.JPGexpand image

TOPICS
PDF forms
2.6K
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 ,
Jun 17, 2021 Jun 17, 2021
LATEST

Here is sample code you can work from, use it in "Dropdown" field validation script and in "Dropdown" field properties under 'options' tab check ' commit selected value immediately'.
You can adapt code to reset colors if needed and also you can use RGB colors since built in object have only few colors at disposal.

if(event.value == "Blue"){
this.getField("Row1.Field1").fillColor = color.blue;
this.getField("Row1.Field2").fillColor = color.blue;
this.getField("Row1.Field3").fillColor = color.blue;}
else if(event.value == "Yellow"){
this.getField("Row2.Field1").fillColor = color.yellow;
this.getField("Row2.Field2").fillColor = color.yellow;
this.getField("Row2.Field3").fillColor = color.yellow;}
else if(event.value == "Green"){
this.getField("Row3.Field1").fillColor = color.green;
this.getField("Row3.Field2").fillColor = color.green;
this.getField("Row3.Field3").fillColor = color.green;}

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