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

please take a look at this code

dbertanjoli
Registered: Nov 18 2007
Posts: 30

This is a question for Thom Parker.
 
I was using your code but it doesn't work exactly as I want it. My e-mail address is [link=mailto:dbertanjoli [at] cw [dot] bc [dot] ca.]dbertanjoli [at] cw [dot] bc [dot] ca.[/link] I will greatly appreciate your reply:
 
Values from price field are copied to the quantity field I am not sure why? I want once, selectin is in the second combo box made to automatically ppopulate two other fields>
 
[,,]
var oAssemblyParts = {
Chasis: [ ["-","None","none"], ["Rear Bracket","205.95","one"], ["Front Bracket",185.95,two], ["Long Support","44.95","three"],["Front Bearing","48.95","four"]],
   
function SetPartEntries()
{
// Only run this code on when the selection is commited.
if(event.willCommit)
{
// There are 3 rows in the order form so in order to use other fields in
// the same row we first have to acquire the name of the row
// we are operating on. This is part of the List field's name, so we
// just have to split it off
var cRowName = event.target.name.split(".").shift();
 
// Now get the new parts list from the Master List
// Since the selection is being committed, event.value contains the selection text
var lst = oAssemblyParts[event.value];
// If an entry is selected that we don't have a parts list for, then
// the parts list is just cleared.
if( (lst != null) && (lst.length > 0) )
this.getField(cRowName + ".PartSelect").setItems(lst);
else
{
this.getField(cRowName + ".PartSelect").clearItems();
}
 
// We have a new parts lists and the first entry is
// is a non-selection. so clear the price field.
this.getField(cRowName + ".Price").value = 0;
this.getField(cRowName + ".Quantity").value = 0;
}
}
  
////////////////
// SetPriceValue()
//
// Function for setting the price value based on the Parts selection value
//
// This function is specifically setup to be called from the Change Event
// of the Parts List. It will not work from another event because the
// "event.willCommit" and "event.changeEx" parameters are used
//
function SetPriceValue()
{
// Only run this code on the un-committed change. This fields is set up
// for Commit on select so we know the value will be committed
if(!event.willCommit)
{
var cRowName = event.target.name.split(".").shift();
 
// If the export value is Not a Number then
// set the price to zero.
var nSelExp = 0;
if(!isNaN(event.changeEx))
nSelExp = event.changeEx
 
this.getField(cRowName + ".Price").value = nSelExp;
 
}
}
   
////////////////
// SetQuantityValue()
//
// Function for setting the price value based on the Parts selection value
//
// This function is specifically setup to be called from the Change Event
// of the Parts List. It will not work from another event because the
// "event.willCommit" and "event.changeEx" parameters are used
//
function SetQuantityValue()
{
// Only run this code on the un-committed change. This fields is set up
// for Commit on select so we know the value will be committed
if(!event.willCommit)
{
var cRowName = event.target.name.split(".").shift();
 
// If the export value is Not a Number then
// set the price to zero.
var nSelExpQ = 0;
if(!isNaN(event.changeEx))
nSelExpQ = event.changeEx
 
this.getField(cRowName + ".Quantity").value = nSelExpQ;
 
}

}

My Product Information:
Acrobat Standard 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This question is a little to broad to answer. First, not enough information is provided. What is the field setup? Did you modify the test form, or build a new document? What funtions are called from what field events? Where exactly is the problem? Narrow it down some. What debug have you done?

This forum is for answering specific questions, not general analysis, which you usually have to hire someone for.

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