In addition, it also blanks the field if the value is not-a-number(NaN) or Infinity, which are usually error conditions. The script provided below handles zero blanking, formats the number with 2 decimal places and adds a "$" symbol. That said, number formatting is not difficult. There is nothing wrong with just choosing one of the built-in formats. However, that's because I'm a programmer and have been at this for a long time. I like to keep calculations as pure numbers, and I also think the built-in formatting is overkill and inefficient and would rather write my own formatting. I am partial to using the Custom Format Event script because it provides control over how the field value is displayed without affecting the real field value. Changes to event.value are shown in the field, but do not change the value of the field. It is used to change how the field value is displayed to the user. The Format event is the last event called when a field value changes. This Properties Dialog is available from the right click menu when the form is in Prepare Form mode. The event scripts for a field are accessed from the Properties Dialog for that field. This allows us to keep the value of the field a pure number so it can be used in other calculations, but show the user something more useful, such as a formatted number with a dollar sign or unit value. The format event is used to set how the value is displayed in the field. You can look up how to use and format a particular function at any time. At this point the field value cannot be changed. The PERCENTILE function, on the other hand, requires the following syntax: PERCENTILE (expression, number) (for example, PERCENTILE ( Sales,0.90) ). Format - This is the last event in the sequence.It is the last chance to change or reject the new field value. Validate - This event happens right after the value is committed.In this case, it happens when the calculation is complete. Value Commit - This is a variation on the Keystroke event that is called whenever a value is committed to a field.A custom calculation script is required in order to test the result and set it to blank. ![]() Calculation - This is the start of the event sequence.To use them requires writing a custom script. These events represent the four stages of updating a field value. ![]() When any field value on a PDF form changes, it triggers 4 events on each field that contains a calculation. It's common to see entire columns on a PDF form containing a useless $0.00.įortunately, there are four ways to intercept the calculation result and set the value to blank (empty string). ![]() Unfortunately, the built-in formatting in Acrobat doesn't support this option. So it is often desirable that calculated fields that result in a 0 value are blank. And, if a group of fields are not used it is less distracting if those fields are blank. Blank fields give a PDF form a cleaner look.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |