Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

How to Set a Drop down of color choices to color fill a text field in RunTime


Level 1

Hi Guys,

I am working on a pdf file and I want the users who will fill up my form to be able to change the text field to any color that they want during runtime. I already have a code, however I would want to add two things:

1. change the yellow to a lighter color of yellow.

2. Add color orange

Here is the code that I got, that I hope you could help me revise for me to achieve it.

var colors = new Array();

for (var i in color)
  colors.push(i); // get a list of colors

while (colors[0] != 'transparent')
  colors.shift();  // bump the non-colors

colors.unshift('Choose a Color:'); // label

var choice = app.popUpMenu(colors); // show menu

if (choice != null) // did user select something?
   this.getField('Label 1').fillColor = eval('color.' + choice);

Thanks, guysss!

0 Replies