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?
Assuming this is the calculation script for "unpaiddays", use this code instead of what you have now:
var v1 = +this.getField("daysleft").value; event.value = (v1<0) ? v1 : "";
When is the "daysleft" computed?
Would not the days left be the difference of the leave left and the requested days?
I would think the unpaid days would then be the requested days in excess of the days left.