0

I creating Fillable PDF (Invoice) in Adobe LiveCycle Designer. I want Automatic fill field Value.

My point is I have 4 Different Items with different Code and diffrent Prices. I have to ask about two field Field1 called " ItemCode" and Field2 called "UnitPrice". I want UnitPrice field automatically filled with ItemCode Price/Value.

Following are the item Codes and their Prices:

018/22.50$

019/39$

020/16$

234/55$

I want JavaScript For Adobe LiveCycle Designer and Adobe Acrobat DC.

Million of thanks.

Community
  • 1
  • 1
  • Your question is a bit unclear because of language problems I think. Do you mean: The user has to fill out two fields (ItemCode and UnitPrice) and then the Field UnitPrice should be automatically filled with ItemCode/UnitPrice (and that 4 times)? Or do you just want to select a product in a Dropdown and Display ist Code and Price in that UnitPrice field? – Cold_Class Dec 05 '16 at 09:40
  • Thank you so much for the answer, I want put ItemCode by myself in Item Code field and i want price would be come automatically in UnitPrice field. Above 018 mean Item Code and 22.50$ is the Price and so,,,,, – Aanis Ramzan IR Dec 05 '16 at 17:29
  • You second Answer is near my Problem, i don't want Dropdown list in ItemCode field i just want put Item code myself and Price of that ItemCode would be come in UnitPrice Field – Aanis Ramzan IR Dec 05 '16 at 17:39

1 Answers1

0

I would do it like this (just one of many different possibilities:

  1. Create a list of items, each item object gets two properties - id and price: (you can also write 22.5 instead of "22.50$" but then you'll have to take care of the formatting inside the UnitPrice field.

    var itemList = [
        {id:18,price:"22.50$"},
        {id:19,price:"39$"},
        {id:20,price:"16$"},
        {id:234,price:"55$"}
    ];
    
  2. In the exit event of the field that you type in the id write:

    var idEntered = parseInt(this.rawValue); 
    for (var i in itemList){
     if (itemList[i].id===idEntered){
      UnitPrice.rawValue = itemList[i].price;
      return;
     }
    }
    

Let me know if you need any help understanding my solution! :)

Cold_Class
  • 3,214
  • 4
  • 39
  • 82