Copy link to clipboard
Copied
I am new to Javascript programming in adobe. I have a purchase req that needs to multiply the qty and the unit cost to get an extended cost. I know I can do this in a simple calculation, but I also want fields that are zero to return blank. the code I have so far is:
event.value=(this.getField("QtyRow1").value * this.getfield("UnitCostRow1").value);
If(event.value==0) event.value = "";
neither stablemen is working. The first does not seem to calculate and the second give me the missing; before statement 2 error...any help you can give would be great.
event.value=(this.getField("QtyRow1").value * this.getField("UnitCostRow1").value);
If(event.value==0) {event.value = "";}
Copy link to clipboard
Copied
You'll want to actually leave the calculated value as zero. You can set how "0" displays in a custom format script like the following.
if (event.value == 0) {
event.value = "";
}
So leave your calculation (the first line, where it is. Move the second line to the Custom Format Script in the other tab.
Copy link to clipboard
Copied
There's an error in your code. Did you check the JS Console?
Copy link to clipboard
Copied
event.value=(this.getField("QtyRow1").value * this.getField("UnitCostRow1").value);
If(event.value==0) {event.value = "";}
Copy link to clipboard
Copied
Thanks...this seemed to solve it! Appreciate your help.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now