Copy link to clipboard
Copied
Hello,
I know this question has been asked a few times, but I couldn't find anything that worked or made sense to me.
I have created a form and I have a few dropdowns that require multiple selection. I don't want to use a list box because I don't like the way they look, they're not easy to use, and they take up too much space. So, I'd like to make it possible to select multiple items in my dropdown lists. I know this might require some javascript, which I have zero experience in.
If you could help me out or give me some clear guidance, I would really appreciate it!
Thank you!
Copy link to clipboard
Copied
Here's a link to the documentation for the app.popUpMenuEx JavaScript method: Acrobat DC SDK Documentation
Copy link to clipboard
Copied
JavaScript won't help. You can't do it with the built-in drop-down field.
It can be done using a pop-up menu, though, which will require doing it using a script to keep track of the items in the list, and whether or not they are selected.
Copy link to clipboard
Copied
Hi Try67,
I've been searching for the way to improve the PDF form. And I see your support is very helpful in Support Community.
I can now make MouseUp to populate the submenu. But as you say, we'd require a script to keep the item when selected. I do not need to do multiple selection, but I need submenu to group different products like below. May you please kindly advise how should I keep the item when I select? My first sript is as below:
var cChoice = app.popUpMenuEx
(
{cName: "gigaNOVA", oSubMenu:
[ {cName: "A10192 Fusca"},
{cName: "A10194 Mixtus"},
{cName: "A10340 Calvus"},
{cName: "A10393 Rubra"},
{cName: "A5645 Mica"},
{cName: "A6111 Comata"} ]
},
{cName: "New gigaNOVA", oSubMenu:
[ {cName: "A10192H Fusca-H"},
{cName: "A10194H Mixtus-H"},
{cName: "A10340H Calvus-H"},
{cName: "A5645H Mica-H"},
{cName: "A6111H Comata-H"} ]
},
{cName: "lamiANT", oSubMenu:
[ {cName: "SR4L002 Lucida"},
{cName: "SR4G008 Sinica"},
{cName: "SR4C033-L Latona Left"},
{cName: "SR4C033-R Latona Right"},
{cName: "SR42W001 Mutica"},
{cName: "SR4C005 Similis"} ]
},
{cName: "RADIONOVA", oSubMenu:
[ {cName: "M20047-1"},
{cName: "M20057-1"},
{cName: "M10578-A2"},
{cName: "M10578-A3"},
{cName: "M20048-1"},
{cName: "M20050-1"} ]
}
)
Copy link to clipboard
Copied
What do you mean by keep selection? The popup menu is created dynamically. Do you want the previously selected item marked? Please post to a new thread and explain more clearly what it is you want to do.
You can read more about popup menus here.
https://www.pdfscripting.com/public/Creating-Popup-Menus.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
You will need to save the selected value somewhere where you can read and write it. For example, in a hidden text field.
Then you use the value of that field to set the bMarked parameter of each item in pop-up menu.
Copy link to clipboard
Copied
Thanks! How can I create the pop-up menu?
Copy link to clipboard
Copied
You would need to use the popUpMenuEx method of the app object, which also allows you to define which items are marked.
Copy link to clipboard
Copied
Sorry, how do I do that? I need an app? I'm sorry, I'm really new to this!
Copy link to clipboard
Copied
No, this is a script that can run within Acrobat or Reader. If you don't have any experience in writing such scripts then it might be a bit complicated. If you're interested in hiring someone to do it for you feel free to contact me privately (try6767 at gmail.com), and we could discuss it further.
Copy link to clipboard
Copied
Thanks, but I'd like to get a good handle on how to do this, because we might have to edit and create new forms and I'd like to be able to do that on my own.
Copy link to clipboard
Copied
Here's a link to the documentation for the app.popUpMenuEx JavaScript method: Acrobat DC SDK Documentation
Copy link to clipboard
Copied
Maybe it is too complicated... but thanks for sending that.

