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

Script to adjust width of dropdown

Community Beginner ,
Mar 25, 2021 Mar 25, 2021

Copy link to clipboard

Copied

Hi,

 

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

 

Thanks in Advance.

TOPICS
JavaScript

Views

658

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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