1 Reply Latest reply on Aug 16, 2014 4:24 AM by try67

    How do I create a function that export text values from selected fields to a summary field?

    S7even

       

      Hello

      I have created an order form in Acrobat 10 and would like to know, how do I create a function that export text values from selected fields to a type of summary field?


      For example: You have made an online order of various items and towards the end of the ordering process you become a text overview (list) of only that which you have ordered.


      My PDF includes: Product description, amount , Price, total and grand total fields for ex.


      Important for me is to get the product description and amount  of only those items which have been ordered onto a separate field.


      I must add, that my Java script knowledge is limited. Any text info is more than welcome.


      Thanks and best regards


      Steven

       

       

       

        • 1. Re: How do I create a function that export text values from selected fields to a summary field?
          try67 MVP & Adobe Community Professional

          So let's assume that your fields are named Product1, Product2, Product3, Amount1, Amount2, Amount3, etc.

          You set the overview field to be multiline and use something like this code as its custom calculation script:

           

          var maxRows = 10; // Change to match actual number of product rows in your file
          var summary = "";
          for (var i=1; i<=maxRows; i++) {
              var amount = +this.getField("Amount"+i).value;
              if (amount>0) {
                  summary += this.getField("Product"+i).value + "\t\t" + amount + "\r";
              }
          }
          event.value = summary;