6 Replies Latest reply on Jan 31, 2013 12:52 PM by George_Johnson

    Variable Drop Down Issue.

    fousthvk

      I am trying to set 3 drop down lists with the same values from a master list. I can get it to set one field but if I add an additional line to the code and call out the additional fields I get a syntax error.

       

      Here is the code.

       

       

      var plCode = {

                             PL1: [ ["-"], ["Double 7"], ["Triple 5"], ["Half-Round"],["Hand-SplitShake"]],

                             PL2: [ ["-"], ["Double 6"], ["Single 7"], ["Double 4"],["Double 4.5 DL"]],

                           };      

       

      function SetProductLine()

      {

         if(event.willCommit)

         {

            var boName = event.target.name.split(".").shift();

       

       

       

            var lst = plCode[event.value];

       

            if( (lst != null) && (lst.length > 0) )

               this.getField(boName + ".Row1_ProfileName").setItems(lst);

               this.getField(boName + ".Row2_ProfileName").setItems(lst);

               this.getField(boName + ".Row3_ProfileName").setItems(lst);

            else

               this.getField(boName + ".Row1_ProfileName").clearItems();

               this.getField(boName + ".Row2_ProfileName").clearItems();

               this.getField(boName + ".Row3_ProfileName").clearItems();

         }

      }

       

       

      After the else works but after the IF statement I cannot have more then one line. If I close it in {} it allows me to use it but only seems to repect line one after the IF statement.

        • 1. Re: Variable Drop Down Issue.
          George_Johnson MVP & Adobe Community Professional

          Does this work:

           

          function SetProductLine() {

           

              if (event.willCommit) {

           

                  var boName = event.target.name.split(".").shift();

                  var lst = plCode[event.value];

           

                  if (lst) [

           

                      getField(boName + ".Row1_ProfileName").setItems(lst);

                      getField(boName + ".Row2_ProfileName").setItems(lst);

                      getField(boName + ".Row3_ProfileName").setItems(lst);

           

                  } else [

           

                      getField(boName + ".Row1_ProfileName").clearItems();

                      getField(boName + ".Row2_ProfileName").clearItems();

                      getField(boName + ".Row3_ProfileName").clearItems();

           

                  }

           

          }

          • 2. Re: Variable Drop Down Issue.
            fousthvk Level 1

            not sure but this did.

             

             

            var plCode = {

                                   PL1: [ ["-"], ["PL1 Double 7"], ["PL1 Triple 5"], ["Half-Round"],["Hand-Split Shake"]],

                                   PL2: [ ["-"], ["Double 6"], ["Single 7"], ["Double 4"],["Double 4.5 DL"]],

                                 };       

             

             

             

             

            function SetProductLine()

               if(event.willCommit){

                  var boName = event.target.name.split(".").shift();

                  var lst = plCode[event.value];

                  if( (lst != null) && (lst.length > 0) ){

                     this.getField(boName + ".Row1|ProfileName").setItems(lst);

                     this.getField(boName + ".Row2|ProfileName").setItems(lst);

                     this.getField(boName + ".Row3|ProfileName").setItems(lst);

            }

                  else

            {

                     this.getField(boName + ".Row1|ProfileName").clearItems();

                     this.getField(boName + ".Row2|ProfileName").clearItems();

                     this.getField(boName + ".Row3|ProfileName").clearItems();

            }

               }

            }

             

             

            I really apreciate you replying. am not just trying to clear some fields if specific things are selected. But I think I can handle that. THANKS!

            • 3. Re: Variable Drop Down Issue.
              fousthvk Level 1

              George how do a set a varible to a list of a dropdown menus current list?

              • 5. Re: Variable Drop Down Issue.
                fousthvk Level 1

                Will that allow me to then use that variable to use in conjunction with setitems to set another drop down with another drops downs values?

                • 6. Re: Variable Drop Down Issue.
                  George_Johnson MVP & Adobe Community Professional

                  That depends on how you code it, but yes, that's certainly possible.