12 Replies Latest reply on Nov 28, 2017 6:58 AM by Bernd Alheit

    populate form from .net using itextsharp but custom calculation script does not see value in text box

    slabbe

      I am using .NET C# to populate hidden fields in a PDF form.  I then have written a custom calculation field to concatenate these field values with text to form a dynamic paragraph.

      I've temporarily removed the hidden property so that I could troubleshoot and when the PDF form comes up I can see these fields have populated.  However the custom calculation script does not seem to see these values as it only shows the 'hardcoded' text from the script.  To simplify the script, I removed all fields to be concatenated except one.  I then put a default value into the text field that would normally get its value from itextsharp.  I then did a preview and the custom calculated field shows the text that I want it to with the default value from the text field.  I am assuming this means the custom calculation javascript is written correctly.

      For a bit of an explanation on the fields:

      CustName: is the field that I expect to receive the value from the C# (itextsharp) program

      FirstParagraph: is the field that has the custom calculation javascript

      I believe that my problem is that the custom calculation field is calculated BEFORE the text field is populated by itextsharp.  I have tried moving the FirstParagraph field to the bottom using the "Set Field Calculation Order".  However, since CustName receives its values from itextsharp  and is not calculated it does not show up in this listing.  I tried making CustName a calculated field by putting a custom calculation script in it.  I then moved FirstParagraph field to be AFTER CustName in the order of calculation.  still nothing appears except the 'hardcoded text'.

      Here is my custom Calculation that is associated with the field FirstParagraph:

           var Cust = this.getField("CustName").value;

           event.value ='WHEREAS, the undersigned ' + Cust;

       

      I've also tried just a straightforward assignment:

            event.value = 'WHEREAS, the undersigned ' + this.getField("CustName").value;

       

      I've also tried ".valueAsString" as a method

       

      None of these have retrieved the information that is passed in.  Please keep in mind the first example retrieves the DEFAULT VALUE of the field CustName, if I put one in.

       

      Any help you can offer is appreciated.