I am not familiar with Acrobat language. I'm trying to create a form fill with the W4 Form. There's a field where I have to add lines 3 and 4, but you can include amounts for credits from another worksheet. So I'm trying to sum the field 3 and 4 if the event value is empty, but if there're some other amount I want to add then I could add the manually and type them in the formfill.
This is the code I currently have:
var v1 = getField("W4D3").value;
var v2 = getField("W4D4").value;
// Set this field value equal to the difference if the field if empty
If (event.value == null)
event.value = v1 + v2;
You probably want event.target.value to be sure you're getting the value of the field and not the value of the event but also, the value of an empty field is not null, it's an empty string. Your code might look like this...
if (event.target.value == "")
event.target.value = v1 + v2;