Skip to main content
Inspiring
February 7, 2025
Answered

Script to expand dropdown

  • February 7, 2025
  • 1 reply
  • 682 views

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;
}

 

Correct answer PDF Automation Station

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;
}

1 reply

PDF Automation Station
Community Expert
Community Expert
February 7, 2025

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.

Inspiring
February 7, 2025

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. 

PDF Automation Station
Community Expert
Community Expert
February 7, 2025

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;
}