1 person found this helpful
Not that easy, it took awhile to realize that one could change a fields value as part of the field's validation process.
I have found you can use the following code in the "Custom Validation Script" on the 'Validation" tab:
// null filed value if entry is zero
if(event.value == 0) event.value = "";
You can use this script for all you calculation fields no matter which calculation option is chosen .
This code will only execute once a field has been updated by a data entry or calculation event. So once you add the code, you may need to clear the form or enter data into a field that is used in a calculation and force the form to recalculate.
I appreciate the reply... (it's been many hours without one)
I tried the validation script, and as you indicated, the only way the total field (with the validation script) appears blank is AFTER the Reset button is clicked. (However I have not checked this in a reader)
I can't see how I can make it work in that manner. Customer inputs Billing & Delivery Addresses at top, then proceeds to select products. If the reset button has to be pressed, all the data (ie. addresses) are removed.
If there was a way to apply the reset function automatically at the opening of the pdf doc. then it would achieve the result I need. I wonder if there isn't a way with a check box at the top that customer clicks which would apply the reset function.
If you (or anyone) has any further tips or help I would appreciate it. This is the last item the client has requested for change.
PS. In case anyone can think of a print script to use... The sum value, when =0 (no qty) needs to print blank sum fields (not $0.00) BUT if there is a sum value, the amount must print (for Ship/Acct Depts)
*** I just thought of something... The only time where the sum value needs to be blank is when customer prints and inputs data by hand.... so, would there be a way to add a print button that can also clear the sum values at the same time with the "reset" function and the validation script???
You would have to add additional conditional testing if you want a zero value to appear if the result of the calculation is zero.
I had to leave this for awhile, but I've come back to update and Thank you for your earlier help.
Although we discussed the script only working after "reset" or as you suggested, a calculation; I in fact found that after simply opening the pdf in Acrobat Reader 9 (vs. Acrobat 9 Pro) - the form sum totals that I added the Validation Script to were blank.
Initially, in Pro, the only way it would work was with the reset function, (there was no change when values were given to the validated sums or the unedited sums - regardless of what I did).
As frustrating as it is, the "preview" mode in Acrobat 9 Pro does not give a true indication of how the pdf doc will appear or function in Acrobat Reader 9. (This may also be true with older version as I have seen similar questions with regards to compatibility of functions between editors and readers.)
Most Important though, the Validation Script does work in Acrobat Reader 9 (which is where it is actually needed). So a big thank you for your help (even though you were not aware that it works unconditionally in the Reader.)