1 Reply Latest reply on Nov 23, 2010 6:12 PM by milligramme

    [JS] - Dynamic RadioButtons and Dropdowns - CS4

    Adobe-InDesign CS4

      Dear All,

       

      I have created Window Based User Interface.

       

      In that user interface Dynamically created radiobuttons and Dropdown lists.

       

      I have written the method like when I am checking the radio button the respective drop down box should be enable at the same time it should send the return value of the both (radio button and drop down box).

       

      When I click the radio button It is not returning any value instead of it gives 'False'.


      Is it possible to get the Dynamic Buttons Value as well as respective Dropdowns box value? Please give me the solutions.


      //========================== Script =================================================//


      DYNAMICWIN = ["First", "SECOND", "THIRD", "FOURTH", "FIFTH", "SIXTH", "SEVENTH", "EIGHTH", "NINETH"];

       

      var myW = new Window('dialog', 'SAMPLE DYNAMIC');
      myW.pannel_DYN =myW.add ("panel", [0,0,300,DYNAMICWIN .length*35], '');

      var x1Position=10;
      var y1Position= 0;
      var x2Position = 60;
      var y2Position =25;

      var x1DropDownPosition  = 130;
      var y1DropDownPosition = 3;
      var x2DropDownPosition = 230;
      var y2DropDownPosition = 10;
      var i;

         var Equ_Cnt_Var=0;
         for(i=0; i<DYNAMICWIN.length; i++)
          {
           if(Equ_Cnt_Var++==i)
           {

           do
           {
           myW.pannel_DYN.RADIOBUTT = myW.pannel_DYN.add('radioButton', [x1Position,y1Position, x2Position, y2Position],  DYNAMICWIN[i].toString());
           y1Position +=35;
           x2Position =DYNAMICWIN [i].toString().length+93;
           y2Position  += 35;
           myW.pannel_DYN.DROPDOWNS  = myW.pannel_DYN.add('dropdownlist', [x1DropDownPosition,y1DropDownPosition,x2DropDownPosition,y2DropDownPosition], undefined)
           myW.pannel_DYN.DROPDOWNS.enabled = false;
           y1DropDownPosition += 35;
          
                   Split_t4 = String(DYNAMICWIN[i]).split("|");
                  for(var pFname=0; pFname<Split_t4.length; pFname++)
                    {
                    var curitem= Split_t4[pFname].toString();
                     myW.pannel_DYN.DROPDOWNS.add("item", curitem);
                     myW.pannel_DYN.DROPDOWNS.selection = 0;
                    } 
       
         myW.pannel_DYN.RADIOBUTT.onClick = function () {
              
        First_DropDownBox = (myW.pannel_DYN.RADIOBUTT.value) ? "Selected" : "";
        if(First_DropDownBox == "Selected")
                      {
                     myW.pannel_DYN.DROPDOWNS.enabled = true;
                     }
                   }

          
           i+=1;
           } while (i <DYNAMICWIN.length);

           }
      }
          myW.show();

      //========================== End  : Script =================================================//

       

       

      Thanks & Regards

      T.R.Harihara SudhaN