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

163

Likes

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
Adobe Community Professional ,
Mar 25, 2021 Mar 25, 2021

Copy link to clipboard

Copied

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

Likes

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
Adobe Community Professional ,
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?

Likes

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.

Likes

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
Adobe Community Professional ,
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

Likes

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