2 Replies Latest reply on Jun 11, 2014 7:53 AM by gkaiseril

    compare two fields and populate a third

    King Blackhead

      I am trying to do the following:


      Filed A number of days leave left

      Field B Total number of days requested (some of other Fields)

      Field C = A - B

      Field D = Listed number of days unpaid to be taken


      If C < 0 then D = C


      I am using the following code


          // Get the field values, as numbers 

          var v1 = this.getField("leaveleft").value; 

          var v2 = this.getField("totaldaysrequested").value; 

          var v3 = this.getField("daysleft").value;

          var v4 = this.getField("unpaiddays").value;



          if (v2 < "0") v4 = v3; 

          unpaiddays.value = v4.value;



      This is not populating the field, what am i doing wrong?