Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Multi-Line Drop Down List - Need HELP!!!!!!!!!!!!!!!

Avatar

Former Community Member
OK..I am a noobie to the Designer process --- this is my first time putting a document together.



I have a question:



I have created a form in which I have a drop down list. However, there is only so much text that is "visible" in the form (there is no room to expand)



As it will not wrpa around to a second line, is there a way to have the drop down do multi-lines (for just one selection)?



i.e. to look like this in the form:



BCS 3243

CORROSIVE, UN1824, PGII, 8, MATERIAL SAFETY DATA SHEET ATTACHED



Does this make sense?



Thanks



Chris
6 Replies

Avatar

Former Community Member
I don't know anyway to automatically wrap a list item. But it can be done manually. The list item would need a hard-return somewhere in the string to force it to wrap. This can't be done using the Designer UI, but it can be done through script.



Using javascript:



xfa.resolveNode("form1.#subform[0].ListBox1").addItem("This item1 is\nwrapped.")

xfa.resolveNode("form1.#subform[0].ListBox1").addItem("This item2 is\nwrapped.")

xfa.resolveNode("form1.#subform[0].ListBox1").addItem("This item3 is\nwrapped.")



Mark

Avatar

Former Community Member
Mark;



Actually....I'd prefer to do it manually.



However, I am such a Noob that I don't know how to accomplish this by Javascript.



Can someone walk me through the basics?



Thanks

Chris

Avatar

Former Community Member
Chris:



If you put the above script in the initialize event of the list box that should do the trick. Unfortunately, I just realized you are trying to do this with a dropdown list. I should have read your issue more carefully. Sorry. Unfortunately, it doesn't work for dropdown lists, which leads me to believe that it is not possible.



Mark.

Avatar

Former Community Member
Chris, to clarify what you require. If your dropdown box has an entry, e.g. "Bacon, Eggs and Hashbrowns", and you want it to appear on 2 lines, the first line being "Bacon, Eggs" with the second line being "and Hashbrowns", e.g.:



Bacon, Eggs

and Hashbrowns



I have created a script on the change event function. I created this for Designer 7.1.2 for use in Reader 7.0.9, Reader 8.1.2, and Acrobat Pro 7. I don't know if it will work if created in LiveCycle ES.



Is this what you need?

Avatar

Level 5
You can make the DropDown list display a single value on multiple lines by inserting a newline character into the text - "\n". In the example above, the source would look like: "Bacon, Eggs\n and Hashbrowns". The trick for you is to figure out where you want to insert the newline. I have used JavaScript in the past to split long strings, inserting the newline at the point of the last blank character before position X. I cannot locate that script right now.



Hope this helps.

Mark

Avatar

Former Community Member
On the DropdownList, select the Change event and it would look like this:



if (xfa.event.newText == "Bacon, Eggs and Hashbrowns"){

(xfa.event.change = "Bacon, Eggs \nand Hashbrowns");

}