3 Replies Latest reply on Feb 14, 2011 4:54 PM by keizeruser

    Display nothing when value = 0

    Yochanan2

      Original question posted in Acrobat Windows forum

      Platform: Win2K, Acrobat 5
      An Acrobat PDF form displays a list of products, each with a read-only price field A (pre filled in), a quantity field B (for the client to enter), and a read-only subtotal field C;
      A x B = C.
      Currently all the C (subtotal) fields show 0,00 when no quantity is entered.
      Is it possible to have C empty, i.e. not showing 0,00, when no quantity is entered.

      The following script for C's custom calculation field was suggested:

       

      total = this.getField("A").value * this.getField("B").value;
      if (total==0) {
          event.value = "";
      } else event.value = total;

       

      Problem is though, as soon as I enter this script and hit OK, I get a message saying "The value entered does not match the format of the field [C]".

        • 1. Re: Display nothing when value = 0
          Yochanan2 Level 1

          I have done some experimentation and I think I have found the cause of the format mismatch message.
          In South Africa, we use the comma as a decimal.
          When selecting a number format from the dropdown list (on the 'Format' tab), I naturally choose the last one, nl. 1234,56 (1234 comma 56) applicable to the 'price' field, the 'quantity' field, as well as the calculated 'total' field.
          The 'price' field is pre filled in and read-only.
          But, and this is pivotal, when entering the price in the 'Default' line (on the 'Options' tab), one has to enter "1 2 3 4 point 5 6" (i.e. without the spaces).
          When exiting the Form Edit mode, the field actually displays 1 2 3 4 comma 5 6.
          And voila! no more format mismatch message!
          I don't understand why, but it works.

          • 2. Re: Display nothing when value = 0
            gkaiseril MVP & Adobe Community Professional

            Have you tried to see want the value is?

             

            Change the field's format to "None".

            • 3. Re: Display nothing when value = 0
              keizeruser

              Thank you. Your invoice example worked like a charm. I have no experience in scripting, but I was able to quickly copy, paste and edit using your example.