-
1. Re: "%0.00" hidden when field is blank.
try67 Jun 18, 2013 6:38 AM (in response to lmphil)As the custom calculation script, enter:
if (event.value=="0") event.value = "";
-
2. Re: "%0.00" hidden when field is blank.
GKaiseril Jun 18, 2013 8:19 AM (in response to lmphil)Like the currency issue you need to use the special built-in formatting functions to modify the field format. For a zero suppression you need to use a format that has no non-numeric characters. Note that the "$", "%", and "," are non-numeric characters.
For a field with a format of "None" user a Custom validation script:
if(event.value == 0) {
event.value = ""; // set field to null;
AFNumber_Format(0, 0, 0, "", "", true); // set format to number 0 decimals, no currency;
} else {
event.value = event.value; // keep value;
AFPercent_Format(2, 0, 0); // set percent format 2 decimal places.
}Another approach would be to use a custom format script.
-
3. Re: "%0.00" hidden when field is blank.
lmphil Jun 18, 2013 8:57 AM (in response to GKaiseril)Thanks for your help. This script is not working for me. Any advice? You also mentioned a custom format script? Thanks again.
-
4. Re: "%0.00" hidden when field is blank.
GKaiseril Jun 18, 2013 9:06 AM (in response to lmphil)What is not working?
-
5. Re: "%0.00" hidden when field is blank.
lmphil Jun 18, 2013 9:22 AM (in response to GKaiseril)Ah, that would probably help! The "%0.00" still appears in the field even though a number hasn't been entered. Does that help?
-
6. Re: "%0.00" hidden when field is blank.
GKaiseril Jun 18, 2013 10:47 AM (in response to lmphil)Did you clear the form or force a calculation?
Validation scripts only run when the form field is updated.
Are there any errors in the JavaScript console?
This script works the same way as the currency formatting, it just uses a different internal format function.
You need to set the field's format to "None" since the validation script is determining the format and not a format script or the format selection (which is a behind the scenes JavaScript). The Formatting of a field is done after the Key Stroke, Validation, and Calculation for the field. See Form Event Processing for the sequence of field event processing. So any formatting applied by the validation or calculation is overridden by the any formatting selection other than "None".
-
7. Re: "%0.00" hidden when field is blank.
lmphil Jun 18, 2013 11:12 AM (in response to GKaiseril)THANKS!!!!! That's exactly what I was missing! Works beautifully!



