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

Combo Entries

CSDesigner
Registered: Jun 20 2011
Posts: 11

Can someone point me in the right direction either with help om this script or a previous post on how to store user inputs from a Combo Box?
 
I have read various information on Arrays and I may be entering the information into the wrong script section for the field. Here is what I have tried to create from other examples: (where "arrange" is the sort function)
 
var list = new Array();
var g = this.getField("signer");
for (var i = 0; i < g.numItems; i++)
list[i] = [g.getItemAt(i,false), g.getItemAt(i)];
list.sort(arrange);
g.clearItems();
g.setItems(list);
 
Any help is appreciated.
Thanks.

My Product Information:
Acrobat Pro 9.0, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Have you looked at the array.sort() method?What is the code for arrange function?
Where are the parameters for the arrange function?

George Kaiser

CSDesigner
Registered: Jun 20 2011
Posts: 11
I set the arrange function as a Document JavaScript. Here is the code for the arrange function:

function arrange (a,b) {
if (a[0] < b[0] ) return -1;
if (a[0] > b[0] ) return 1;
return 0;
}
I will look into the provided link now.

Thank you for the response but I may be going about this the wrong way upon thinking. Should I first commit the entries to a separate hidden field on the form and then call the information from the field to the Combo Box?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You never said what didn't work in the script. What's the result of running it. Are any errors reported?

The sort function is incorrect for the type of elements that are being passed into it. The loop is building an Array of 2 element arrays. Its the two element array that is passed into the sort function.

Have you read this article?
list programming



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