Planet PDF Forum Archive

Planet PDF ForumThis is from our 160,000 page PDF discussion forum archive one & two spanning 1999-2011. Use the filters on our Advanced Search page to search archive only. Head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions.


Previous | Next | (P-PDF) What's Wrong with my PDF?


Topic: Livecycle Form Help
Conf: (P-PDF) What's Wrong with my PDF?, Msg: 171291
From: Delgadoworks
Date: 8/28/2009 07:58 AM

Problem: Problem.
a.I want to add a new field to
a. search the table
b. Look at the value of index1
c. If the value = 2, return the value of in the numAmount field.
I need a for loop that will go through each instance row that the user has added.

Here is a breakdown of my situation:

1. I have a table that will allow the user to add rows when they click the plus button. Here is the code

----- form1.Page1.Table7.#subformSet[0].#subformSet[1].detailHeader2.Button2::click: - (JavaScript, client)
_detail.addInstance(this.parent.index);
xfa.form.recalculate(1);


2. The table also has a button to delete rows. Here is the code
----- form1.Page1.Table7.#subformSet[0].detail.Button2::click: - (JavaScript, client) --------------

_detail.removeInstance(this.parent.index);
xfa.form.recalculate(1);

3. The table has a drop down list named txtPartNum and that allows you make a selection. Once you have made the selection a script populates other fields in the same row. The Drop Down list contains this code:

----- form1.Page1.Table7.#subformSet[0].detail.txtPartNum::initialize: - (JavaScript, client) ------

// Populate the part number Drop-down List.
partNoScript.populatePartNo(this);

----- form1.Page1.Table7.#subformSet[0].detail.txtPartNum::change: - (JavaScript, client) ----------
// Populate the description and the unit price when we change the part number.

partNoScript.getDesc(xfa.event.newText, txtDescription, numUnitPrice, index1);


4. The following script populates the following fields:
txtPartNum,
txtDescription,
numUnitPrice,
index1
----- form1.#subform[2].#variables[0].partNoScript::partNoScript - (JavaScript, client) ------------

// This script object controls the interaction between the part number, description and unit price fields.

// When you fill the partNo, partDesc and partPrice arrays, make sure they have the same number of array indices in
// each array i.e. for every part number, there should be a matching description and price.

// Array of part numbers.


// This script object controls the interaction between the part number, description and unit price fields.

// When you fill the partNo, partDesc and partPrice arrays, make sure they have the same number of array indices in
// each array i.e. for every part number, there should be a matching description and price.

// Array of part numbers.

var partNo = new Array(" ",
"Company Labor - Regular Hours",
"Company Labor - Overtime Hours",
"Company Engineering - Regular",
"Company Engineering - Overtime",
"Company Burden",
"Subcontract Labor",
"Subcontract Engineering",
"Subcontract Material",
"Subcontract Equipment",
"Subcontract Labor & Material Bid",
"Purchased Materials",
"Materials from Inventory",
"Transportation Equipment",
"Miscellaneous Tools Shope and Garage",
"Construction Equipment",
"Rental Equipment",
"Permits",
"Legal Fees",
"Other Miscellaneous");

// Array of part descriptions.

var partDesc = new Array(" ",
"1221.9922",
"1222.9922",
"1221.9922",
"1222.9922",
"1221.9922",
"1232.9933",
"1232.9933",
"1232.9933",
"1232.9933",
"1232.9933",
"1201.99119",
"1201.99119",
"1201.99139",
"1201.99139",
"1201.99139",
"1201.99139",
"1250.994",
"1250.994",
"1250.994");

var partPrice = new Array(null,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0);


var partDesc2 = new Array(1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20);




var partDesc3 = new Array(" ",
"CLIN ",
"CLIN ",
"CLIN",
"CLIN",
"PO, NTP or C#",
"PO, NTP or C#",
"VENDOR NUMBER",
"CLIN",
"CLIN");

// Populate the part number Drop-down List.

function populatePartNo(dropdownField)
{
var i;
for (i=0; i < partNo.length; i++)
dropdownField.addItem(partNo[i]);
}

// Populate the description and unit price fields.

function getDesc(partNumber, descField, itemPrice, partNumber1, partNumber2)
{
var i;
for (i = 0; i < partNo.length; i++) // Go through the entire list of part numbers to find the one that is currently selected.
{
if (partNo[i] == partNumber) // When we find the part number currently selected.
{
descField.rawValue = partDesc[i]; // Put the description in the description field
itemPrice.rawValue = partPrice[i];
partNumber1.rawValue = partDesc2[i];
partNumber2.rawValue = partDesc3[i];// and put the unit price in the unit price field.
break; // No need to go further if there is a match.
}
}
}

Problem. I want to add a new field to
a. search the table
b. Look at the value of index1
c. If the value = 2, return the value of in the numAmount field.
The following if statement does only part of what I want. But only if the value is 2 on the first row. Not any of the other rows belowit.
----- form1.#subform[2].Table5.Row5.CL1::calculate: - (FormCalc, client) ---------------------------

if (form1.Page1.Table7.#subformSet[0].detail.index1 == 2)
then
$.rawValue = form1.Page1.Table7.#subformSet[0].detail.numAmount.rawValue
endif

I need a for loop that will go through each instance row that the user has added.


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist 11

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Two Passwords Are Better Than One: The Low-Down On PDF Security

For people who don't spend their time looking at PDF files in text editors*, PDF security is a sometimes misunderstood beast.

For example, those document restrictions that PDF files sometimes have -- no Printing, Content Copying, Page Extraction, etc -- are essentially useless unless the PDF also has a User Password.

January 09, 2014
Platinum Sponsor



Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist 11

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.