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

Combo Box change background color

New Here ,
Nov 01, 2019 Nov 01, 2019

Hi, I'm creating a form in Acrobat DC, I have a field (Combo Box) that has the following options:
Delivery
Pickup
Shipping

What I want to do is that when you select Delivery the background of the combo box changes to Red, if I select the Pickup option the background of the combo box changes to Green and if I choose Shipping it changes to Purple.

Somebody could help me?

TOPICS
PDF forms
595
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 ,
Nov 01, 2019 Nov 01, 2019

An easy way to do this is to add a custom validation script like this

 

switch(event.value)

{

     case "Delivery":

          event.target.fillColor = color.magenta;

          break;

     case "Pickup":

          event.target.fillColor = color.red;

          break;

}

 

Keep in mind that "event.value" is the display value, not the export value of the item. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Nov 02, 2019 Nov 02, 2019
LATEST

Just make sure you disable the Fields Highlighting option in the application to see the changes, as it overrides the fill color of the fields.

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