PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/ __________________________________________________________________

The form is indeed right, assuming that you have no illegal calculations when all fields are empty. When you format fields, you will get this effect.

One thing you have to consider before you start making adjustments to your form is whether 0 is indeed a legal result. With that, I mean whether a legitimate calculation using filled in fields can lead to 0, and whether these numbers are intermediate results, which we use in further calculations. If all this is not the case, we can be a little bit less careful with the methods to suppress these zeroes...

Let's assume that all the mentioned things are not the case, one approach has already been mentioned in the list. You simply evaluate the result and if it is zero, you set the field value to blank.

However, this may not be correct in some cases. I don't know if it applies for you, but as you have done some serious analysis of the case, you would know. One of the main approaches for the case that you may have illegal results, or use the values for further calculations, is to not do the calculations until all the entry values (and therefore also your calculations) are valid. This would give the following structure:

if (this.getField("myField").value != "" && this.getField("anotherField").value != "") {
// we have all valid input
doCalculations() ;
} else {
// not all valid input
this.getField("result").value = "" ;
}


Now, if we need the results for further calculations, but still want to suppress them, we also could switch to controlling the display of the fields, and use the Format event, which would leave the field value untouched. We might need to use the util.printf() method, in order to create the formatting we want, as in this case, we no longer can use the shortcuts to set the format of the fields.

Hope, this can help.


Max Wyss PRODOK Engineering Low Paper workflows, Smart documents, PDF forms CH-8906 Bonstetten, Switzerland

Fax:  +41 1 700 20 37
  or  +1 815 425 6566
e-mail:  mailto:[EMAIL PROTECTED]
http://www.prodok.com



[ Building Bridges for Information ]


______________________




Shameless Plug:

My next conference appearances and workshops:
• Conference presentations at the 2004 Symposium of the BFMA, May 23 to 27 in Reno, Nevada (http://www.bfma.org) and pre-/post-conference workshop, May 22/23 and 27, organized by essociates Group (http://www.essociatesgroup.com/AdvancedAcrobatForms.htm)
• And, as always, available for on-site workshops/tutorials/consulting.



_________________________






I have a calculated numeric field with the calculation being the product of 2 other fields "QuantityOrdered1" & "UnitPrice1". By default when the form fires up, the value "0.00" is displayed in the calculated field. When I input soetihng the value shows correctly.

I would like to not display or print the default "0.00" that is in the field if I don't enter anything in the quantity and unit price fields.

Is there a way to do this? Can some one please point me in the right direction.



To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html



Reply via email to