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

Programming List Problem

KDCS
Registered: Sep 30 2009
Posts: 36
Answered

I built an XFA form in LCD 8.2 similar to the one in the tutorial by Thom Parker that uses variables to select. If the 2 variables have the same dollar value associated with them, when you select the second selection the list reverts to the first selection.

In other words:

If I have: "Reel 1", 200 and "Reel 3", 200 when I select Reel 3 the pull down menu reverts to Reel 1.

Can someone tell me if this can be fixed and how?

Thank you.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
I use another method for populating dropdown boxes, where your/this problem is not present.

For that I use a scriptobject in the form, that contains the arrays for part number, part names and part prices.

form1.#subform[0].#variables[0].MyArticles - (JavaScript, client)var MyPartNumbers = new Array("000124478","011548872","054475639","422578788","855542300"); //5 var MyPartNames = new Array("Gear 12Z","Clutch M33","Upper Scrapper ","CIS Unit 334dS-9B","Hinge L"); //5 var MyPartPrices = new Array("22.90","158.95","11.00","253.90","22.90"); //5

Also in the script object there is a function for populating a drop down list with the part numbers.
function PN_Populate(dropdownField){for (var i=0; i < MyPartNumbers.length; i++)dropdownField.addItem(MyPartNumbers[i]);}

And finally a function to populate the fields for the part name and price depending on the selection that have been made in the drop down list.
function PN_ReadOut(PN_Alias, Name_Alias, Price_Alias){for (var i = 0; i < MyPartNumbers.length; i++){if (MyPartNumbers[i] == PN_Alias){Name_Alias.rawValue = MyPartNames[i];Price_Alias.rawValue = MyPartPrices[i];break;}}}

In the form I have a table with a drop down list for selecting the part numbers, that has two scripts.
One to trigger the function to populate the part numbers from the script object.
this.clearItems();MyArticles.PN_Populate(this);

And the other to trigger the function to populate the other field of the table with the part name and price.
MyArticles.PN_ReadOut(xfa.event.newText, PartName, PartPrice);
The function works as follows.
If you select the third part number the script returns the third value of the part name array and also the third value of the part price array.
So, there is a parallelism between all arrays.
The positive effect is, that it doesn't matter if there is the same value sevaral times in the arrays.
I hope this is what you're looking for!

[url]https://share.acrobat.com/adc/document.do?docid=bd7a4b23-76a7-4dc0-99a8-6e535aadd096[/url]

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

KDCS
Registered: Sep 30 2009
Posts: 36
Thank you radzmar. That is exactly what I wanted. I appreciate the help. You have helped me many times with your posts. Please keep up the great work.