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

hier_list_box with multiple select

garath
Registered: Mar 24 2009
Posts: 49
Answered

Is there a possibility to create hier_list_box with multiple select in ADM dialog?

And second thing: is there a possibility to collapse all nodes at dialog initialization?

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
No, Unfortunately neither of these is a supported feature. The JSADM provides little control over this complex control.

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

garath
Registered: Mar 24 2009
Posts: 49
What about collapsing nodes?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
No, About all you can do from the script is select a node

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

garath
Registered: Mar 24 2009
Posts: 49
Ok. But maybe You have an idea how to present users more or less 1000 records. The can be grouped in 10-20 records. If I present all hier_list_box with all nodes "open", they will probably kill me.

And one more question: is there any possibility to add remove nodes from hier_list_box and list_box?
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Maybe you could use two list boxes. The first will contain the categories and the second the actual records. When the user selects a category in the first box you update the second one with the matching records.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

garath
Registered: Mar 24 2009
Posts: 49
But I need this in pop-up and I cannot find script to add/remove records from hier_list_box and list_box
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Try67 has great idea. Use two list boxes and repopulate the second box when an entry in the first box is selected. Entries can by dynamically loaded into the list boxes using the "dialog.load()" function. Using exactly the same syntax you use in the Initialize function. There are posts on this forum that describe the process. Do a search on "dialog list".

Also, have you looked at AcroDialogs? This tool could be a tremendous help for your dialog project.
http://www.windjack.com/products/acrodialogs.php

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

Phlox
Registered: May 6 2010
Posts: 6
I followed your recommendation and created two list boxes with the Help of AcroDialogs.
As I am not yet familiar with Javascript, I don't know where to put the dialog.load() function.

What I want to do is somthing like this:

If list1.standort = BRANCHGERMANY then display var BRANCHGERMANY in List box lst3
else ...
else ...

Can I use a "case" event to verify which data is to be displayed in List box "lst3"?


This is the code:

Formular1.Formular.Seite1.deutsch.Textfeld1[0]::mouseUp - (JavaScript, client)
//Acrobat JavaScript Dialog
//Created by DialogDesigner from WindJack Solutions


var BRANCHGERMANY ={
"1111111111 Marketing":1,
"2222222222 HR":2,};

var BRANCHUSA = {
"3333333333 Marketing":3,
"4444444444 HR":4,};

var BRANCHFRANCE = {
"5555555555 Marketing":5,
"6666666666 HR":6,};

var JSADMDlg1 =
{

result:"cancel",
DoDialog: function(){return app.execDialog(this);},
standort:["Germany"],
stredt2:"",
strlst3:"",
SetListSel:function(list,path){if(path.length == 0) return;
eval("list[\""+ ((typeof path.join != "function")?path:path.join("\"][\"")) + "\"] = 1")},
GetListSel:function(oLstRslts,path){
for(var item in oLstRslts){
if( ((typeof oLstRslts[item]=="number")&&(oLstRslts[item]>0))
|| this.GetListSel(oLstRslts[item],path) )
{path.push(item);return true;}
}
return false;
},
initialize: function(dialog)
{
var listlst1 =
{
"Germany": -1,
"USA": -1,
"France": -1,
};
this.SetListSel(listlst1, this.standort);

var listlst3 = new Object();
this.SetListSel(listlst3, this.strlst3);

var dlgInit =
{
"sta1": "Bitte Standort auswählen!",
"lst1": listlst1,
"sta3": "Bitte Abteilung auswählen!",
"sta4": "Suchen:",
"edt2": this.stredt2,
};
dialog.load(dlgInit);
},
commit: function(dialog)
{
var oRslt = dialog.store();
var path = new Array();
this.standort = (this.GetListSel(oRslt["lst1"],path))?path.reverse():"";
this.stredt2 = oRslt["edt2"];
var path = new Array();
this.strlst3 = (this.GetListSel(oRslt["lst3"],path))?path.reverse():"";
},
description:
{
name: "JSADM Dialog",
elements:
[
{
type: "view",
width: 848,
height: 707,
elements:
[
{
type: "static_text",
item_id: "sta1",
name: "Static Text 1",
width: 155,
height: 23,
},
{
type: "list_box",
item_id: "lst1",
variable_Name: "standort",
char_width: 8,
char_height: 8,
},
{
type: "gap",
item_id: "gap1",
width: 553,
height: 15,
char_width: 4,
char_height: 4,
},
{
type: "view",
width: 214,
height: 28,
char_width: 8,
char_height: 8,
align_children: "align_row",
elements:
[
{
type: "static_text",
item_id: "sta3",
name: "Static Text 3",
width: 158,
height: 23,
},
{
type: "static_text",
item_id: "sta4",
name: "Static Text 4",
width: 61,
height: 23,
alignment: "align_row",
},
{
type: "edit_text",
item_id: "edt2",
width: 190,
height: 23,
char_width: 8,
alignment: "align_row",
},
]
},
{
type: "list_box",
item_id: "lst3",
width: 838,
height: 516,
char_width: 8,
char_height: 8,
},
{
type: "ok_cancel",
},
]
},
]
}
};

// Example Code
JSADMDlg1.standort = ["Germany"];
JSADMDlg1.stredt2 = "";
JSADMDlg1.strlst3 = "";
if("ok" == JSADMDlg1.DoDialog())
{

console.println("lst1:" + JSADMDlg1.standort);
console.println("edt2:" + JSADMDlg1.stredt2);
console.println("lst3:" + JSADMDlg1.strlst3);
}
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Each element has an Action Function associated with it. Look on the properties window for the first list that shows the countries. The action function will be run whenever a selection is made. It's here where you need some code to load the other list. Something like this
// Get all the current element valuesvar rslt = dialog.store(); // Get the list selectvar path = new Array();var cSel = ((this.GetListSel(oRslt["lst1"],path))?path.reverse():"").toString(); // Load second list based on selected valueswitch(cSel){case "Germany":dialog.load({"lst3":BRANCHGERMANY});break;case "USA":dialog.load({"lst3":BRANCHUSA});break;case "France":dialog.load({"lst3":BRANCHFRANCE});break;}

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.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

Phlox
Registered: May 6 2010
Posts: 6
I don't get it. Where does the variable listlst4 come from?


Acrobat JavaScript Debugger Functions Version 9.0
Acrobat 9.0 - Integrierte Escript-Funktionen
Acrobat 9.0 - Integrierte Anmerkungs-/Teamworkfunktionen
Acrobat 9.0 - Integrierter Assistent für Anmerkungs-/Teamworkfunktionen
Adobe Acrobat SOAP 9.0
lst1:
lst3:
lst1:
edt2:Vorstand
lst3:
lst1:USA
edt2:
lst3:

listlst4 is not defined
46:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld2[0]:mouseUpReferenceError: listlst4 is not defined([object ADMDialog])@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld2[0]:mouseUp:46
execDialog([object Object])@:0
()@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld2[0]:mouseUp:17
@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld2[0]:mouseUp:119
lst1:USA
edt2:1111*
lst3:
lst1:USA
edt2:
lst3:
lst1:France
edt2:
lst3:

missing : after property id
77:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp
this.getListSel is not a function
68:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUpTypeError: this.getListSel is not a function([object ADMDialog])@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp:68
execDialog([object Object])@:0
()@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp:21
@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp:178

this.getListSel is not a function
68:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp
this.getListSel is not a function
68:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUpTypeError: this.getListSel is not a function([object ADMDialog])@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp:68
execDialog([object Object])@:0
()@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp:21
@XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp:178

this.getListSel is not a function
68:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp
missing ; before statement
176:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp
missing ; before statement
168:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp
missing ; before statement
168:XFA:Formular1[0]:Formular[0]:Seite1[0]:deutsch[0]:Textfeld1[0]:mouseUp




Formular1.Formular.Seite1.deutsch.Textfeld1[0]::mouseUp - (JavaScript, client)
//Acrobat JavaScript Dialog
//Created by DialogDesigner from WindJack Solutions


var BRANCHGERMANY ={
"1111111111 Marketing":1,
"2222222222 HR":2,};

var BRANCHUSA = {
"3333333333 Marketing":3,
"4444444444 HR":4,};

var BRANCHFRANCE = {
"5555555555 Marketing":5,
"6666666666 HR":6,};

var JSADMDlg1 =
{

result:"cancel",
DoDialog: function(){return app.execDialog(this);},
standort:["Germany"],
stredt2:"",
strlst3:"",
SetListSel:function(list,path){if(path.length == 0) return;
eval("list[\""+ ((typeof path.join != "function")?path:path.join("\"][\"")) + "\"] = 1")},
GetListSel:function(oLstRslts,path){
for(var item in oLstRslts){
if( ((typeof oLstRslts[item]=="number")&&(oLstRslts[item]>0))
|| this.GetListSel(oLstRslts[item],path) )
{path.push(item);return true;}
}
return false;
},
initialize: function(dialog)
{
var listlst1 =
{
"Germany": -1,
"USA": -1,
"France": -1,
};
this.SetListSel(listlst1, this.standort);

var listlst3 = new Object();
this.SetListSel(listlst3, this.strlst3);

var dlgInit =
{
"sta1": "Bitte Standort auswählen!",
"lst1": listlst1,
"sta3": "Bitte Abteilung auswählen!",
"sta4": "Suchen:",
"edt2": this.stredt2,
};
dialog.load(dlgInit);
},
commit: function(dialog)
{
var oRslt = dialog.store();
var path = new Array();
this.standort = (this.GetListSel(oRslt["lst1"],path))?path.reverse():"";
this.stredt2 = oRslt["edt2"];
var path = new Array();
this.strlst3 = (this.GetListSel(oRslt["lst3"],path))?path.reverse():"";
var rslt=dialog.store();
var path = new Array();
var cSel = ((this.getListSel(oRslt["lst1"],path))?path.reverse():"").toString();
switch(cSel)
{
case "Germany":
dialog.load({"lst3":BRANCHGERMANY});
break;
case "USA":
dialog.load({"lst3":BRANCHUSA});
break;
case "France":
dialog.load({"lst3":BRANCHFRANCE});
break;
}
},
description:
{
name: "JSADM Dialog",
elements:
[
{
type: "view",
width: 848,
height: 707,
elements:
[
{
type: "static_text",
item_id: "sta1",
name: "Static Text 1",
width: 155,
height: 23,
},
{
type: "list_box",
item_id: "lst1",
variable_Name: "standort",
char_width: 8,
char_height: 8,
},
{
type: "gap",
item_id: "gap1",
width: 553,
height: 15,
char_width: 4,
char_height: 4,
},
{
type: "view",
width: 214,
height: 28,
char_width: 8,
char_height: 8,
align_children: "align_row",
elements:
[
{
type: "static_text",
item_id: "sta3",
name: "Static Text 3",
width: 158,
height: 23,
},
{
type: "static_text",
item_id: "sta4",
name: "Static Text 4",
width: 61,
height: 23,
alignment: "align_row",
},
{
type: "edit_text",
item_id: "edt2",
width: 190,
height: 23,
char_width: 8,
alignment: "align_row",
},
]
},
{
type: "list_box",
item_id: "lst3",
width: 838,
height: 516,
char_width: 8,
char_height: 8,
},
{
type: "ok_cancel",
},
]
},
]
}
};

// Example Code
JSADMDlg1.standort = ["Germany"];
JSADMDlg1.stredt2 = "[""]";
JSADMDlg1.strlst3 = "[""]";
if("ok" == JSADMDlg1.DoDialog())
{

console.println("lst1:" + JSADMDlg1.standort);
console.println("edt2:" + JSADMDlg1.stredt2);
console.println("lst3:" + JSADMDlg1.strlst3);
}
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I don't know, that's a debug issue for you to solve. But switch block for setting the second list should not be in the "commit" function. It needs to be in the Action Script for the first list.

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.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

Phlox
Registered: May 6 2010
Posts: 6
I managed to solve all errors except one:

Initialise 3DxInput Device ...
3DxInput Device ready
Initialise 3DxInput Device ...
3DxInput Device ready

this.getListSel is not a function
44:XFA:Formular1[0]:Formular[0]:Seite1[0]:flaggen[0]:Textfeld1[0]:enterTypeError: this.getListSel is not a function([object ADMDialog])@XFA:Formular1[0]:Formular[0]:Seite1[0]:flaggen[0]:Textfeld1[0]:enter:44
execDialog([object Object])@:0
()@XFA:Formular1[0]:Formular[0]:Seite1[0]:flaggen[0]:Textfeld1[0]:enter:21
@XFA:Formular1[0]:Formular[0]:Seite1[0]:flaggen[0]:Textfeld1[0]:enter:170


http://pastebin.ca/1880399

the window pops up, but there are no values to select in the first list.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This code doesn't make any sense in the Init Function:
var path = new Array();var cSel = ((this.getListSel(["lst1"],path))?path.reverse():"").toString();var oRslt = dialog.store();switch(cSel){case "Germany":dialog.load({"lst3":BRANCHGERMANY});break;case "USA":dialog.load({"lst3":BRANCHUSA});break;case "France":dialog.load({"lst3":BRANCHFRANCE});break;};

The dialog has not been displayed yet so there are no values in the dialog fields. The "dialog.store()" function cannot be used. If the dialog will be initialized to something other than "Germany" then the switch statement will use the "this.standort" variable, since that is both the initial value and the result of the list value.

This code needs to be in the "Action" function for "lst1" so that it switches "lst3" at runtime

The error is thrown because the name of the function is "GetListSel()", with a capital "G".


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.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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