Skip to main content
Known Participant
June 11, 2016
Question

PopMenu selection to change drop down field's fill color?

  • June 11, 2016
  • 1 reply
  • 872 views

I have a popMenu button with a list of names in my doc. There are roughly 18 drop downs as well and each are associated with a particular name in the popMenu list. What I would like to do is when I select, let's say, Steve from the popMenu, then what I want to happen is all the drop downs fill colors change to the same color. Like light grey. When I select a different name from the popMenu list of names then Steve goes back to white and the name selected, let's say, Albert's drop downs turn to light blue. And so forth.

The drop downs are all visible and should remain visible. The only thing that should change are the fill colors of the drop downs. Then back to white when a different name is selected. Is something like this possible? Can someone tell me the way to do this. I just don't know. I really haven't gotten into this area. Until now. I've been searching around for the answer and/or help but cannot find what I need. Thanks guys.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 12, 2016

So there's a specific drop-down associated with each name in the pop-up menu?

try67
Community Expert
Community Expert
June 12, 2016

If that's the case then you can use something like this (adjust the field names and other missing bits, of course):

var resp = app.popUpMenu( ... );

this.getField("DropdownSteve").fillColor = (resp=="Steve") ? color.ltGray : color.white;

this.getField("DropdownAlbert").fillColor = (resp=="Albert") ? ["RGB", 135/255, 206/255, 250/255] : color.white;

// etc.

pdfUser1Author
Known Participant
June 12, 2016

I'm running into a little curve in the road. This is the popMenu script I'm using. The script you provided is a little different than mine. I have tried it in mine and only the first name worked. I tried your script in a completely different popMenu button without any other options and it worked fine.

My question is, how do I combine your script with mine (or visa versa)? I have enclosed the popMenu I'm using. As you see it's a little different. I have quite a few options also in mine. This is just a snippet of what I have. Are the two scripts completely different in the way they work? The first difference I think is the "resp" and the "case" and "break".

var itemIndex = app.popUpMenu("blah", "blah", "blah", "-", ["Names","Steve", "-", "Albert", "-", "Mary", "-", "Juni"] );

switch (itemIndex)    {

    case "":

        break;

       

    case "":

        break;

    case "":

        break;

//and so on

}

What do you think?