7 Replies Latest reply: Sep 11, 2013 8:26 AM by lmphil RSS

    Calculated field hidden when field is blank

    lmphil Community Member

      This is actually similar to a discussion from a few months ago.Our forms are intended to be filled out online, printed and e-mailed, faxed, or snail-mailed. Many times the customer will simply print out the form and fill it out by hand. When I create forms with calculations the "$" or "0.00" appear; thus making it difficult for someone filling the form out by hand to work around those symbols/numbers. A few months ago, I had a similar situation involving percents and the gurus on this forum (Thank you, gurus!) helped me with the following code and it worked perfectly at hiding the calculated fields unless something was entered in the fields to be calculated.

       

       

      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.
      }

       

       

      This time, the problem involves simple numbers (not percent, not currency). I used the same logic and the fields actually show/hide like I want, but the numbers need to be formated with a comma separating the thousands and a decimal point with two digits after. I can't figure that out! Can someone please offer some advice? Thanks in advance for your help.