7 Replies Latest reply on Feb 6, 2012 2:29 PM by try67

    Help with Dropdown and Checkboxes

    blacksox_19

      I have a dropdown named ComponentArea and some checkboxes with an Export Value of Yes

       

      to keep it short we will say two

       

      CTObj and ComObj

       

      What I want to happen is if they select American History in the dropdown (ComponentArea) I want it to check CTObj and mark it readonly and clear ComObj and make sure it is not marked readonly

        • 1. Re: Help with Dropdown and Checkboxes
          try67 MVP & Adobe Community Professional

          You can use this code as the MouseUp code of your drop-down:

           

          var v = this.getField("ComponentArea").value;

          if (v == "American History) {

               this.getField("CTObj").checkThisBox(0,true);

               this.getField("CTObj").readonly = true;

           

               this.getField("ComObj").checkThisBox(0,false);

               this.getField("ComObj").readonly = false;

           

          }

          • 2. Re: Help with Dropdown and Checkboxes
            blacksox_19 Level 1

            Ok I am showing my ignorance but that is ok.  Thank you for your help.  The dropdown has different values and I want the checkboxes to change based on what is selected.  It did do work correctly with the syntax you provided above.  But after CTObj is check if you select Communications in the dropdown nothing will change after that.

             

            var v = this.getField("ComponentArea").value;

             

            if (v == "American History") {

                 this.getField("CTObj").checkThisBox(0,true);

                 this.getField("CTObj").readonly = true;

                 this.getField("ComObj").checkThisBox(0,false);

                 this.getField("ComObj").readonly = false;

            }

            else if (v == "Communications") {

                 this.getField("CTObj").checkThisBox(0,false);

                 this.getField("CTObj").readonly = false;

                 this.getField("ComObj").checkThisBox(0,true);

                 this.getField("ComObj").readonly = false;

            }

            • 3. Re: Help with Dropdown and Checkboxes
              blacksox_19 Level 1

              Ok I was trying different things out and I think I see what is happening.  It does work but only if i click it and then go click ont he dropdown again.  Is there anything to make it immediate?

               

              For instance the way it is working now is if I choose American History it checks the right box but while it is open if I check communications it does not change.  But if I leave it on communications and go to another box taking the focus off of the dropdown and go back it will work when clicking on the dropdown.

              • 4. Re: Help with Dropdown and Checkboxes
                blacksox_19 Level 1

                Unless there is a better way I think I got it to work with an On Blur event

                • 5. Re: Help with Dropdown and Checkboxes
                  try67 MVP & Adobe Community Professional

                  Make sure you tick the option "Commit the selected value Immediately".

                  • 6. Re: Help with Dropdown and Checkboxes
                    blacksox_19 Level 1

                    Is there some kind of 49 or 50 line limitation in the javascript editor?  I was going over that and I kept getting an error at line 49.  There was no error and I split it up into two or three seperate events and it worked.

                    • 7. Re: Help with Dropdown and Checkboxes
                      try67 MVP & Adobe Community Professional

                      No, if there is a limit it's much higher. You must have had some syntax

                      error in your code.