2 Replies Latest reply on Dec 12, 2013 8:27 AM by cbianco251

    Help with an if/then script in a writable pdf form

    cbianco251

      I am working a performance review and need some help.  On the recap page there are 5 fields that sum up into a total.  That total then can fall into one of three score brackets.  How can I set it up so the appropriate score bracket is highlighted in a specific color based on the total.

       

      For example- if the total field is 0-29, then the box that has the range of 0-29 would highlight in red.  If the total is 30-39, then the box that has the range 30-39 would highlight yellow and if the total is 40-45 it would highlight that box in green.

       

      Is this possible and how do I do it?

        • 1. Re: Help with an if/then script in a writable pdf form
          gkaiseril MVP & Adobe Community Professional

          Yes one could do this with a custom JavaScript validation for the total field.

           

          var StrokeColor = "T"; // clear stroke color;

          switch(true) {

          case event.value < 0) :

          StrokeColor = "T";

          break;

          case (event.value < 30) :

          StrokeColor = color.red;

          break;

          case(event.value < 40) :

          StrokeColor = color.yellow;

          break;

          case(event.value <= 45):

          StrokeColor = color.green;

          break;

          default:

          StrokeColor = "T";

          break;

          }

          var oTotal = this.getField(event.target.name);

          oTotal.strokeColor = StrokeColor;

          • 2. Re: Help with an if/then script in a writable pdf form
            cbianco251 Level 1

            Thank you for responding!  Forgive me this is all Greek to me so I have a few more questions.  I don't want the total field to change colors I would like the have one of the three boxes become highlighted based on the value in the total box (and that may be what you sent over and I just don't understand!)  So I guess I would need to put a validate code in each of the boxes?