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

Drop-down Menu Formatting issue

Community Beginner ,
Sep 07, 2018 Sep 07, 2018

is there a way to make the text wrap in a drop down menu in adobe forms so I can see multiple lines of text? I need to add options that are too long and don't show on one line.

TOPICS
PDF forms
7.4K
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 ,
Sep 07, 2018 Sep 07, 2018

Do you mean an actual popup menu, or do you mean the ComboBox(DropDown) form field?

In the first case, the popup menu does not support multiline items, but the dropdown form field does. The multiline entries are added with a script, like this:

this.getField("Dropdown").setItems(["Red\nApple", "orange", "Red\nPear"]);

The first and last entries use the newline character "\n" to create two lines in those entries.

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
Community Beginner ,
Sep 07, 2018 Sep 07, 2018

Sorry I meant drop down menu. I have an item that doesn't fit in the box because it's too long and I need it to have like a multi line or wrap text feature so it will stay it the box whether it's a paragraph or a few words. Hope that is more clear. 

Sent from my Sprint Samsung Galaxy S8.

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 ,
Sep 07, 2018 Sep 07, 2018

So if I use red\npearl then it would show like this as an end result:

RedPeal 

Even though I am just selecting red\npearl in the menu? 

So if I had a paragraph I could just figure out how many characters long a box is and put a \n at the right spot and all the words would wrap and show in one box? 

Sent from my Sprint Samsung Galaxy S8.

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 ,
Sep 07, 2018 Sep 07, 2018

List items do not automatically wrap lines, but you can hard code newline characters. So yes, if you had a whole paragraph you can manually wrap it by inserting newlines. The selected result is the text with the inserted newline, so your sample result would be

Red

Peal

Since it contains a new line. However, it is easy to replace these newlines with spaces:

var strResult = this.getField("Dropdown1").valueAsString.replace(/\n/," ");

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
Community Beginner ,
Sep 10, 2018 Sep 10, 2018

Thom that didn't work. any other ideas?

The bottom edge needs to be cut up 2” from any hard surface and 4” from landscaping. In some areas bottom edge needs to be sealed properly to not allow insects and moisture from entering the system.

This is what I need to wrap if it helps.

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 ,
Sep 10, 2018 Sep 10, 2018

I would advice you don't do that. It's an undocumented feature and it doesn't work very well. You'll notice it behaves strangely when you select an item with a line-break.

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 ,
Sep 10, 2018 Sep 10, 2018

TRY67,

I couldn't even get that to work but I am sure I am doing it wrong. can you please tell me how I would use a line break so I can see what it does? also do you have a different solution? seems kind of strange Adobe offers it in a standard text box but not a drop down menu?

Thanks for your time

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 ,
Sep 11, 2018 Sep 11, 2018

The code provided by Thom is correct, and is the only why of doing it. This is what it looks like (notice the buggy way in which the "pear" objects moves around):

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 ,
Sep 11, 2018 Sep 11, 2018

Great. Can you tell me exactly how to do that please

Sent from my Sprint Samsung Galaxy S8.

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 ,
Sep 11, 2018 Sep 11, 2018

Use the code provided above by Thom. It's what I did...

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 ,
Sep 11, 2018 Sep 11, 2018

Can you please give me a step by step or point me in the direction of something to read to tell me exactly how to do that. 

Sent from my Sprint Samsung Galaxy S8.

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 ,
Sep 11, 2018 Sep 11, 2018

You mean how to run the script? You should read this tutorial (also by Thom, by the way): https://acrobatusers.com/tutorials/javascript_console

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 ,
Sep 11, 2018 Sep 11, 2018

That's not what I meant but thanks I will play with it and figure it out. 

Sent from my Sprint Samsung Galaxy S8.

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 ,
Sep 11, 2018 Sep 11, 2018

So what did you mean?

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
New Here ,
Mar 08, 2024 Mar 08, 2024
LATEST

1) Where do I copy+paste the script?

2) Which fields do I replace with my own text so it shows up in line 1 and line 2?

I'm in the same boat as bterry302. I think these were the questions s/he was trying to get at.

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
New Here ,
Sep 02, 2020 Sep 02, 2020

I agree. This is a most frustrating part of Dropdowns. I want to create dropdowns with with multiple options for standardised paragraphs in a form, but the result doesn't wrap to the sides of the box created - very frustrating. What I'm reading in the responses is that you need to be some kind of Javascript code writing guru to make it kind of work. This text wrapping should be the default for any field that can take text or numbers regardless. Adobe - Please fix this. I create forms and documents and I shouldn't also have to become a specialised code writer to achieve what I need to achieve.

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