These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

list_box dialog load

lucianopilla
Registered: Oct 18 2007
Posts: 76
Answered

[img]http://www.gridero.it/download/pilla/alert.jpg[/img]

hello Thom, i refer directly to you for tring to solving this problem.
i want to put results of query's sql into a dialog load. i know that it's work fine because the app method gives back all values i need.
how can i do for passing these value into a dialog load.
Regards. Luciano Pilla

Adding intelligence to documents

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
To load values into a custom dialog you have to format them in the correct way.

Like This:

var MyListValues = {
"apple":-1,
"Orange":1,
"Grape":-1,
};

Where "Orange is the selected value. If the values are already in an array, then do the conversion like this:

var theVals = ["Apple","Orange","Grape"];
var MyListValues = {}; // Create empty object

for(var i=0;i

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

suyogkale2002
Registered: Apr 21 2009
Posts: 9
Hi homp,
can you please tell me how we can set the list_box listitems order :
example i have following items in list box

Item no 1
Item no 2
Item no 3
Item no 4
Item no 5

i want to show them in list_box in following order

Item no 4
Item no 5
Item no 1
Item no 2
Item no 3

how to rearrange the list items
can i set the item order like

ITEM OrderId
Item no 1 3
Item no 2 4
Item no 3 5
Item no 4 1
Item no 5 2

waiting for answer.......thanks in advance.

regards,
SDK
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Unfortunately the ADM list box is automatically sorted lexically. There are no other options. So the only ways to enforce a sorting order is to prefix the items. For example

01:Item no 4
02:Item no 5
03:Item no 1
04:Item no 2
05:Item no 3

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

suyogkale2002
Registered: Apr 21 2009
Posts: 9
hi thomp,

thanks for your reply
but i agree ADM list box is automatically sorted lexically.
at present i am also showing list items by concanating digits before string
like :

01:Item no 4
02:Item no 5
03:Item no 1
04:Item no 2
05:Item no 3

but what will happen if listitems count increases more than ten.

this will show like :

01:Item no 1
010:Item no 10 <-
011:Item no 11 <-
02:Item no 2
03:Item no 3
04:Item no 4
05:Item no 5
06:Item no 6
07:Item no 7
08:Item no 8
09:Item no 9

and this will be bug............

regards,
SDK
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Since it's lexical sorting, all the prefixed digit strings need to be the same length. It doesn't have to start with a 0.

01:Item no 1
02:Item no 10
03:Item no 11
04:Item no 2
05:Item no 3
06:Item no 4
07:Item no 5
08:Item no 6
09:Item no 7
10:Item no 8
11:Item no 9

If you are writing a script to set this up automatically then use the "util.printf()" function

var cItemLabel = util.printd("%02d:%s",nIdx,cItemName);

where "nIdx" is the index of the list item, and "cItemName" is the original item text.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script