4 Replies Latest reply on Feb 13, 2012 2:31 PM by gkaiseril

    Question about Percent Function

    johnAdonaldson1

      This kinda goes along with my question about the plus sign. That was answered by the fact it means there is more than can be displayed in the field with the plus sign. The problem I am having is all of the fields with the plus sign are formated to be PERCENT. These fields are filled in via the C# program. The values are calculated in the C# program and outputed to the PDF form in the form of 00.00 - 100.00. Thus if I am filling in these fields with values that are within a PERCENT range, then why are they showing a plus sign. I have even go as far as to wipe the field clean, re-do the Text box, re-format as PERCENT, with the text centered, and the No Calculation radio button set true. The only other thing I do these fields is set the FONT to 10 point or otherwise the huge in size.

        • 1. Re: Question about Percent Function
          try67 MVP & Adobe Community Professional

          The value of a percent field needs to be between 0 and 1. If you enter 100,

          it will show up as 10,000.00%, which is probably why the text is too long

          for the field.

          • 2. Re: Question about Percent Function
            gkaiseril MVP & Adobe Community Professional

            The Percentage format just changes the way the decimal value is displayed, a shift of the decimal place 2 digits to the right and add the percentage character string, but does not alter the computed or entered decimal value. This approach allows for the display of the percent value and retaining the decimal value for computations.

            • 3. Re: Question about Percent Function
              johnAdonaldson1 Level 1

              Thank you all for the help on this. What I found is:

               

              it is correct that the incoming value to a fillable field for a PERCENT must be between 0 and 1 BUT this is NOT the complete answer.

               

              If I filled the field with 33.33 then it will display  33.33 + which says the display is too big.

              If I filled the field with .3333 thin it will display .3333 without the PLUS sign, but is still not correct because the FORMAT is set to PERCENT.

               

              What I had to do is add the following JAVA script.

               

              // Custom Calculate script for text field
              (function () {

                  // Get the field values
                  var v1 = getField("NO_FEAR_ASSOC_WITH_TARGETED_DISABILITY_PERCENT_1").value;
                 
                  // Set this field value
                  event.value = v1;

              })();

               

              Now if the input is .3333 the display is now 33.33% which is correct. Sense the JAVA Script is basicly a NOP, this tells me that the PERCENT format requires some kind of trigger. Sense a FILL is NOT a trigger, the display comes out incorrect.

              • 4. Re: Question about Percent Function
                gkaiseril MVP & Adobe Community Professional

                If you look at the properties window for a a field or the "setAction" method of the field object, you will see there are trigger actions for "keystroke", "Validate", "Calculate", and "Format" and some others. These actions use JavaScript to test or format the values of a field.

                 

                Yes, one can get percentages larger than 100 just like in real life, but if you want to perform a calculation based on a percentage value having the value in a decimal value and not a percentage value allows one to use just the value of the field rather than having to adjust the value of the field before calculation. The display of the value of the field with adjustments for percentage or the inclusion a special non-numeric characters like currency symbols or percentage signs all contribute to making the calculation using the computation value much easier.

                 

                The plus sign in the corner is warning that the display text is being truncated.