2 Replies Latest reply on Jan 8, 2013 12:26 PM by joezing

    How can I construct and pass a variable to the getField function?

    joezing

      I need to know how to construct and pass a variable to the getField() function:

      I have a form of several sections similar to a spreadsheet.  Each section contains 5 rows of 11 columns.  Currently I have field-level calculations that I want to consolidate and move to the document level.  The field names in each column are identical with the exception of  a line identifier.  For example, in row 1:  a_debtType1, a_debtTerm1, adebtRate1, etc.  I want to be able to pass a document level function the line identifier and plug that into a 'getField' function.  Here is an example:

       

      Document Level:

      function calculateLoan(lineNumber) {

      var myDate = getField("a_debtType"+lineNumber).valueAsString;

      var myDate = getField("a_debtTerm"+lineNumber).valueAsString;

      ...some processing

      return

      }

       

      Form Level:

       

      //edit form loan information for line 1

       

      function calculateLoan("1");

       

      Thank you in advance for any help.