4 Replies Latest reply on May 26, 2014 4:56 PM by gkaiseril

    Conditional Disabling (graying-out) button

    nabnub

      Hi everyone,

       

      I've came across this post of Thom Parker ( http://acrobatusers.com/tutorials/print/js_disabling_fields )

       

      is there a solution of disabling a button with a condition on another fields (instead of the radio buttons used ont thom's example)

       

      For instance, IF a particular field is > 70

                              => enable the button

                          ELSE

                              => disable the button

       

      Thanks  a lot for any suggestion

        • 1. Re: Conditional Disabling (graying-out) button
          gkaiseril MVP & Adobe Community Professional

          Yes. You may need to adjust the code that calls the function to use an "if" statement to determine if the function should be called or not. You will also need to write a custom JavaScript to perform the task. You will also need to decide when you want the code to run and place the code accordingly.

           

           


          • 2. Re: Conditional Disabling (graying-out) button
            nabnub Level 1

            I think it's beyond my current knowledge, further guidance and details would be much appreciated

             

            Thank you

            • 3. Re: Conditional Disabling (graying-out) button
              nabnub Level 1

              I've manage to do the following, here is the pdf: http://cjoint.com/14mi/DEyxrTjO29S.htm

               

              but it seems there is a conflict with the codes (which one come first)

               

              could anyone have a look a them please, thank you for your help

               

              Basically, the modified code is underneath:

               

              Then, I've put ManageFormFieldToGray("AuthCode") within "Result1Row1" which has already a code retrieving a value from the attachment

               

              // Function to manage form fields function
              ManageFormField (cFieldName)
              {

              var seuil = this.getField("CHAMP-SEUIL").value;
              if (seuil > 70)
              {

                 // First acquire the field to be enabled
                 var oFld = this.getField(cFieldName)
                 // Next acquire the hidden field with the normal colors
                 var oNmlFld = this.getField("NormalColorsFld");
                 if(oFld)
                 {
                    // Make field interactive
                    oFld.readonly = false;
                    // Restore Normal Colors
                    oFld.fillColor = oNmlFld.fillColor; oFld.borderColor = oNmlFld.borderColor; oFld.textColor = oNmlFld.textColor;
                 }

              }
              else
              {

                 // First acquire the field to be disabled
                 var oFld = this.getField(cFieldName)
                 if(oFld)
                 {
                    // Make field Read-Only
                    oFld.readonly = true;
                    // Set Grayed out colors
                    oFld.fillColor = ["G", 0.75]; oFld.borderColor = ["G", 2/3]; oFld.textColor = ["G", 0.5];
                 }

              }
              }

              • 4. Re: Conditional Disabling (graying-out) button
                gkaiseril MVP & Adobe Community Professional

                Check the JavaScript console for errors.