Have you tried to set the fields to a format of "Number' with 2 decimal places and no currency symbol?
I have found that if you use the currency symbol in the format one cannot suppress the "$0.00", it can only be suppressed with the "Number" format and no currency symbol.
If that is your entire script, how are you accessing the field objects for the amount fields?
You need to first access the field object before testing the "value" property of the field or setting the "value" property of the field.
Thank you, GKaiseril,
Next, I did not use the currency symbol for either unit_price(i) or amt_(i).
Yes, this is my entire script. Should I have VAR statements for amt(i)? I have to admit that I really have no clue what I am doing. I only know about VAR statements only because I’ve been looking at a lot of code over the last few days.
So then, are you suggesting that, before the statements that I already have, I should put the following VAR statements?
var amt(2) = 0.00;
var amt(3) = 0.00;
var amt(4) = 0.00;
var amt(10) = 0.00;
GKaiseril, I am really hoping that you can help me with the code because I really can’t spend longer than today on this task. My job is on the line. To further clarify, here is what I wish to accomplish.
Thank you so much, in advance, for your kind assistance, GKaiseril.
The point about your code which begins using amt2 is that amt means nothing at all and isn't connected to the field called amt2 unless you connect it. You do this usually using getField, which you should find in many examples as well as the documentation.
I would use the custom validation field for each "amnt#" field to supresss the zero value as well as the other fields. The validation script can be as simple as;
if(event.value == 0) event.value = ""; // suppress a zero value;
This script works no mater how the calculation for the field is performed. The form will have to recalculate for the validation scripts to run. You can enter a value into a field or clear the form to accompllis the recalculation.
You will still have other issues with your script.
I want to thank you, GKaiseril and Test Screen Name, for your help. Sadly, I've had to abort the exercise. Time did not permit me to continue working on it. I had to accept defeat. Fortunately, my job was not threatened by this.
You may well have the aptitude... and it all looks intimidating at first. But what you do need (and realistically identify) is time, and lots of it, to learn by practicing, and a willingness to read lots and lots of stuff. Good luck!