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

Programming List and Combo fields

prespares
Registered: Nov 6 2008
Posts: 47

Hello,

I am using Thom Parkers example for Programming Lists and Combo fields, and when I export the XML, the Part List and Price return the same value. In the pdf, they are different.

I checked Thom's original XFA Form Example and his xml returns the same issue. Just looking for a solution as I would like to re-purpose the data collected to be used in some excel reports.

Thanks!
Joe

You can see my form at:
http://forums.adobe.com/message/2367412#2367412

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Each item in a list or combobox has an export value. It is this export value that's exported to XML. On the demo the export values are the price values. The idea was to provide the most simplified way of selecting a price. This is probably not the best methodology though. First, the export values are required to be unique, while actual item prices are not. And on a real form you'd probably want actual product info, so it would be more useful to export the products ID or Stock number.

In this case you'd need a global object that maps the Product ID to the Product price, very much like the global object that maps an assembly to a new list of part entries. In fact these could be same list. The code for setting the price then needs to be changed to use this mapping.

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

prespares
Registered: Nov 6 2008
Posts: 47
Thanks Thom,

I understand the reasoning that you shared. Just don't know how to do this.

Would a change event in PartsList of "Partlist.rawValue = Partlist.formattedValue;" work?

Joe
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
No, nothing so simple. In the example file what you would to do is either remove the Parts list exports or change them to some meaningful product info. Like a product ID. Do this by switching out the part price with a Part ID number entry in the "Parts" arrays in the AssemblyList object and of course modifying the code to setup the lists appropiately. This whole object is contructed in such a way that it makes the coding easier. Adding in this new feature kind of breaks that nice setup.

For now the simplest way to deal with the prices would be to add in a second one dimensional object that maps all part numbers to prices. Something like this:

var ThePartPrices = {Br002:250.95, BR303:22.35, etc....};

where BR002 is a part number. Then the code in the function for setting the prices on the partslist change event becomes:

this.getField(cRowName + ".Price").value = ThePartPrices[nSelExp];

You see, rather than using the export value directly to set the price value, the value is aquired indirectly through another object.

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