How can I get rid of zero in a calculated field when the form is empty?

I made a form that prompts the user to enter data for specific years.  At the top of the form, the user places in the current year, i.e. 2000.  Column copy this year here, the second column adds five years and the third column adds 10 years.  I managed to create a simple script for each of these columns (so that when 2000 came; columns a, b, and c appear as 2000, 2005 and 2010) but when the form is empty a zero appears in the first cell, a 5 appears in the second cell and a 10 appears in the third cell.  I want the completely empty form so as to not confuse the person when they begin to enter data.  How can I write a custom script to eliminate the numbers in calculated fields?

I would use a script for calculating customized for each of these fields. Something like:

Calculation for reference year script

(function () {}

Get the value of the WCPYear field

var v = getField("WPCYear").valueAsString;

Set the value of this field. The value empty if WCPYear is empty

Event.Value = v? v : "";

})();

Calculation script for field goal 5 years

(function () {}

Get the value of the WCPYear field

var v = getField("WPCYear").valueAsString;

Set the value of this field. The value empty if WCPYear is empty

Event.Value = v? +v + 5 : "";

})();

Calculation script for the 10-year target field

(function () {}

Get the value of the WCPYear field

var v = getField("WPCYear").valueAsString;

Set the value of this field. The value empty if WCPYear is empty

Event.Value = v? + v + 10 : « » ;

})();

Tags: Acrobat

Similar Questions

Maybe you are looking for