Skip to main content
Inspiring
Feb 7, 2025 12:50 AM UTC
Answered

Script to expand dropdown

Hi. I'm looking for help with a script to expand a dropdrown to show all options when the value of another cell is greater than 0. Can someone help with this? Thanks

var comp = this.getField("text").value;
var ins = this.getField("dropdown").value;

if(comp > 0 && ins == "--"){
  event.target.fillColor = color.red;
  // enter code to expand dropdown here
}
else{
  event.target.fillColor = color.transparent;
}

 

PDF Automation Station
Community Expert
Feb 7, 2025 1:37 AM UTC

Change your Dropdown calculation script to this:

var comp = this.getField("text").value;
var ins = event.value;

if(comp > 0 && ins == "--"){
event.target.fillColor = color.red;
// enter code to expand dropdown here
}
else{
event.target.fillColor = color.transparent;
}

7 replies

PDF Automation Station
Community Expert
Community Expert
Feb 7, 2025 1:07 AM UTC

A dropdown can only be expanded by clicking the arrow with the mouse.  You could pop up an alert showing all the options.  If you want to show all options probably use a list box.

Translate
Inspiring
Feb 7, 2025 1:19 AM UTC

Okay.

Is there a way to change the style of the box to highlight it to bring it to the user's attention?  I have the fillColor as red, but it doesn't show unless the user clicks on it. 

Translate
PDF Automation Station
Community Expert
Community Expert
Feb 7, 2025 1:37 AM UTC

Change your Dropdown calculation script to this:

var comp = this.getField("text").value;
var ins = event.value;

if(comp > 0 && ins == "--"){
event.target.fillColor = color.red;
// enter code to expand dropdown here
}
else{
event.target.fillColor = color.transparent;
}

Translate