3 Replies Latest reply on Mar 18, 2014 12:33 PM by gkaiseril

    Hide fields

    Efe

      I have 14 text fields named "box1, box2, .... box14" and a text field named "final".

       

      I want to hide "final" until all 14 boxes have an input.

       

      How do I code that?

       

      Acrobat Pro XI

        • 1. Re: Hide fields
          gkaiseril MVP & Adobe Community Professional

          You need to use Custom JavaScript coding.

           

          I would use the custom calculation javascript for the "final" filed.

           

          function GetField(cName) {

          // get field object fro cName field with error reporting;

          var oField = this.getField(cName);

          if (oField == null) app.alert("Error accessing field " + cName);

          return oField;

          } // end GetField funciton;

           

          var bFinal = true; // logical to indicate all fields completed;

          for(i = 1; i < 15; i++) {

          if(GetField("box" + i).value == GetField("box" + i).defaultValue;) {

          // field's value same as default value so not completed;

          bFinal = false; // set not ready;

          } // end value not equal default value;

          } // next field;

          if(bFinal == true) {

          var oFinal = GetField("final");

          oFinal.display = display.visible;

          var oBox;

          // hide all "box#" fields;

          for (i =1; i < 15; i+=) {

          oBox = GetField("box" + i);

          oBox.display = display.hidden;

          } // next field;

          } // end bFina true;

          • 2. Re: Hide fields
            Efe Level 1

            Hey, thanks for it! However I get syntax error on oBox lines, also says missing ) before "// field's value same as default value so not completed;" part. Couldn't manage it :/

             

            And I don't need any error until the boxes are all filled. Just need it to be hidden.

            • 3. Re: Hide fields
              gkaiseril MVP & Adobe Community Professional

              The error message includes a line number that might be helpful.

               

              I have not created a form to check the script.