3 Replies Latest reply on Aug 17, 2015 6:45 PM by jay45807004

    Need to use 3 different fields, javascript isn't working

    jay45807004


      I'm new to javascript and am trying to make a form into a pdf, automate some of the math functions, and place it on our website.  One of the fields requires javascript.  If the percentage of work completed  is 50% or less, then the Retainage amount would be 5% of the Total completed work and stored materials.  If the percentage of work completed is greater than 50%, then the Retainage is 2.5% of the Total completed work and stored materials. I tried writing a code several different ways but none of them work, here's my best shot, any help would be appreciated:

       

      Part of the form looks like:

       

      1. Work completed to date per attached (_____ %).      //Field named: PercentWorkCompletedtoDate                                                               

      3. Total completed work and stored materials:                  $____________________      //Field named: TotalCompletedWork&StoredMaterials

      4. Less Retainage:                                                             $____________________     //Field named:  LessRetainage     

       

      I've tried several versions based on my limited javascript tutorial, this is my best shot for the custom calculation script in the LessRetainage field, but it still doesn't work, any help would be appreciated:

       

      If (this.getField("PercentWorkCompletedtoDate”).value <=50) {(this.getField(“LessRetainage”).value = .05 * (this.getField(“TotalCompletedWork&StoredMaterials”).value

      else {(this.getField(“LessRetainage”).value = .025 * (this.getField(“TotalCompletedWork&StoredMaterials”).value}