Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

compare two fields and populate a third

$
0
0

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?


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>