Expand my Community achievements bar.

Display a value based on Text value selected in the dropdown list

Avatar

Former Community Member

I am newbie in creating PDF forms.. I recently created a form patterned with Purchase Order Form sample that came along with the LiveCycle installation.. I can say I am doing good as I was able to create a functioning form with hours of triasl and errors.  Now, I got stucked with my table calculations.. The first column is a dropdownlist with refreshment Items, the 2nd is the quantity column, 3rd is the unit price column and last is the amount column.  After so many days and hours of trying to make the unit price display automatically after you select an item.  I am not an expert in scripts or in PDFs for that matter.. Can somone please help me with my problem.. My dropdownlist is populated by script but by the object pallete in LiveCycle.

menu.JPG

2 Replies

Avatar

Level 10

Hi,

check this thread in AUC forums.

It's may be axactly what you're looking for.

http://acrobatusers.com/forum/forms-livecycle-designer/programming-list-problem/

You also can download a sample form I made for this thread under:

https://acrobat.com/app.html#d=vXpLI3anTcCZqG5TWq3Qlg

Avatar

Former Community Member

Hi thanks for the reply... I practically copied the script from the form you made, I removed the other array... But I can't make it work, been working on it since you replied on this thread.  Please check my script below and find out what or where is the error.

RefreshmentOrderform.RefreshmentOrder.Header.#variables[0].Myitems - (JavaScript, client)

var Itemdesc = new Array(

"Apple",

"Grapes",

"Banana",

"Melon",

"Grapefruit"); //5

var MyUnitPrices = new Array(

"1.90",

"8.95",

"1.00",

"3.90",

"2.90"); //5

function PN_Populate(dropdownField)

{

for (var i=0; i < Itemdesc.length; i++)

          dropdownField.addItem(Itemdesc[i]);

}

function PN_ReadOut(Item_Alias, Price_Alias)

{

for (var i = 0; i < Itemdesc.length; i++)

          {

          if (Itemdesc[i] == Item_Alias)

                    {

        Price_Alias.rawValue = MyUnitPrices[i];

              break;

                    }

          }

}