Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Script to adjust width of dropdown

Community Beginner ,
Mar 25, 2021 Mar 25, 2021

Hi,

 

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

 

Thanks in Advance.

TOPICS
JavaScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2021 Mar 25, 2021

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2021 Mar 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 25, 2021 Mar 25, 2021

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2021 Mar 25, 2021
LATEST

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines