Skip to main content
Known Participant
March 25, 2021
Question

Script to adjust width of dropdown

  • March 25, 2021
  • 2 replies
  • 1132 views

Hi,

 

Do we have a script to adjust the width of the dropdown?

 

Thanks in Advance.

This topic has been closed for replies.

2 replies

Inspiring
March 25, 2021

You need to provide more information. You say you want to adjust the width, but under what conditions? At the time a user is using the form or when you're setting it up, or something else?

Ridhi5EA5Author
Known Participant
March 25, 2021

Need to resize the dropdown width, when select the value in another drop down.

Thom Parker
Community Expert
Community Expert
March 25, 2021

Use the custom validation script to detect the change on the dropdown that triggers the resizing.  

 

Here's an example.

 

var oFld = this.getField("NextDropdown");
switch(event.value)
{
    case "Select1":
       oFld.rect = rctSelect1;
       break;
    case "Select2":
       oFld.rect = rctSelect2;
       break;
}

 

In this example I use 2 preset rectangle arrays. The presets are better than trying to manage resizing dynamically. To get the preset rectangle values, just resize the dropdown to be whatever you want. The use the console window to capture the current rectangle size. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Nesa Nurani
Community Expert
Community Expert
March 25, 2021

You need to use 'rect' event to adjust field size with script.