Hi,
I have created three objects - DropDownList1, DropDownList2, TextField1. DropDownList1 has three items: “Selection1”, “Selection2”, “Selection3”. I need to populated the second drop-down list based on a selection from the first drop-down list (it’s done successfully with switch-case statement). In addition TextField1 should show bound value of the second drop-down list.
The problem is that, when I make selection from DropDownList2, some selected items are not displayed correctly. For example, if you chose “Selection2” from DropDownList1 and then “ASBESTOS” from DropDownList2 it displays “ALACHLOR” instead of the selected item “ASBESTOS”. It is hard to explain this in words, you have to try it in my sample form yourself.
Temporary link to my sample *.pdf: http://www.box.net/shared/5kqbl4tj1f
Javascript code:
---------------------
form1.#subform[0].DropDownList1::change - (JavaScript, client)
---------------------
switch(xfa.event.newText)
{
case "Selection1":
…
break;
case "Selection2":
DropDownList2.rawValue = null;
DropDownList2.clearItems();
TextField1.rawValue = null;
DropDownList2.addItem("ALACHLOR", "[b]1[/b]");
DropDownList2.addItem("ALDRIN", "1");
DropDownList2.addItem("ANTHRACENE", "1");
DropDownList2.addItem("AS AND COMPOUNDS", "5");
DropDownList2.addItem("ASBESTOS", "[b]1[/b]");
…
break;
case "Selection3":
…
break;
}
---------------------
form1.#subform[0].DropDownList2::change - (JavaScript, client)
TextField1.rawValue = this.boundItem(xfa.event.newText);
---------------------
I can’t manage to figure out what is the problem, many thanks to anyone who can help me with this issue!
Have you read this article:
http://www.acrobatusers.com/tutorials/2007/js_list_combo_livecycle/
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