4 Replies Latest reply on Mar 15, 2012 10:21 PM by yep80

    acrobat x if statements

    yep80

      Hi,

       

      I have just started to use Acrobat x Standard and know only the basics.

       

      What I’m trying to do is have a comment in a text field (CommuntiyComments) visible if both Community.value>4 and radio button Choice1 is selected.

       

      So far I can't get both statements together.

       

      Any help is appreciated.

       

      Cheers

        • 1. Re: acrobat x if statements
          gkaiseril MVP & Adobe Community Professional

          You can use "&&" logical AND operator to join the 2 logical statements.

           

          // get the value of the community value field

          var CC = this.getField("Community.value").value;

          // get the value of the Choice 1 radio button

          var RB = this.getField("Choice 1").value;

          // test for community.value > 4 and Choice 1 is selected (value not equal to "Off")

          if(CC > 4 && RB != "Off") {

          // set CommunityComments field to visible

          this.getField("CommunityCommets").display = display.visible;

          } else {

          this.getField("CommunityCommets").display = display.hidden;

          }

          • 2. Re: acrobat x if statements
            yep80 Level 1

            GKaiseril,

             

            Thanks for the reply.

             

            I added this script to the validation tab for CommunityComments but in preview nothing happened when I entered a 4 and selected "yes"?

             

            Any ideas?

            • 3. Re: acrobat x if statements
              gkaiseril MVP & Adobe Community Professional

              Any errors in the JavaScript console?

               

              You are aware that the validation script is only executed for the CommunityComments field only when an entry is made in the CommunityComments field and one moves out of the CommunityComments field.

              .

              I would use the "On Blur" action for the text and radio button/check box

              • 4. Re: acrobat x if statements
                yep80 Level 1

                Sorry if this is painfull but like I said I know only the basics.

                 

                I have the following error coming up in the console.

                 

                If the script is "on blur' in the community box I get “(CommunityComment") is null” when I click out, I get the same error for the choice 1.

                 

                cheers