Copy link to clipboard
Copied
I'm developing a custom dialog that will be used to fill out form text fields when inserting stamps.
The code below is in my initialize function:
dialog.load({
"sub1":
{
// Note: positive value represents the default item
"A": -1,
"B": -2,
"C": -3,
"D": +4, // default item
"E": -5
}
});
The code below is in my description dictionary, as one of the elements
{
type: "view",
align_children: "align_left",
elements:
[
{
type: "cluster",
name: "Provider",
elements:
[
{
type: "static_text",
name: "Select Item",
font: "default"
},
{
type: "popup",
item_id: "sub1",
variable_Name: "sub1",
width: 150,
height: 20
},
]
}
]
},
My question is, how can I prevent acrobat from sorting elements shown in the dropdown menu alphabetically? The way it is, those elements are sorted in alphabetical order but I'd like to have them in the specific order I typed them in the code.
obs.: I tried changing the values of the "sub1" dictionary but they don't change the order of the options. The + number does change what is the default option though.
i.e. this didn't change the order of the list:
"sub1":
{
// Note: positive value represents the default item
"A": -5,
"B": -4,
"C": -3,
"D": +2,// default item
"E": -1
}
Hi,
For me, you have to push all of them one at a time.
Try that in your script:
// This dialog box is called when the dialog box is created
initialize: function (dialog) {
dialog.load({ "usnm": this.strName });
dialog.load({ "lsnm": this.strLastName });
this.loadDefaults(dialog);
},
loadDefaults: function (dialog) {
// Liste des couleurs
dialog.insertEntryInList({"sub1":{"D": +2}});
dialog.insertSeparatorEntryInList("sub1");
dialog.insertEntryInList({"sub1":{"A": -5}});
dialog.
...
Copy link to clipboard
Copied
Hi,
For me, you have to push all of them one at a time.
Try that in your script:
// This dialog box is called when the dialog box is created
initialize: function (dialog) {
dialog.load({ "usnm": this.strName });
dialog.load({ "lsnm": this.strLastName });
this.loadDefaults(dialog);
},
loadDefaults: function (dialog) {
// Liste des couleurs
dialog.insertEntryInList({"sub1":{"D": +2}});
dialog.insertSeparatorEntryInList("sub1");
dialog.insertEntryInList({"sub1":{"A": -5}});
dialog.insertEntryInList({"sub1":{"C": -3}});
dialog.insertEntryInList({"sub1":{"E": -1}});
dialog.insertEntryInList({"sub1":{"B": -4}});
},
and you will get:
@+
Copy link to clipboard
Copied
Thank you, it worked perfectly!
Copy link to clipboard
Copied
You're welcome, let me know if you need more help for your stamp!
@+