1 Reply Latest reply on Aug 26, 2015 10:20 AM by AadeshSingh

    Need help with javascript for OCG layer visibilty

    tammys21400643

      I have a code for making layers visible based on a drop down menu option, but I need only one layer to be visible at a time, not all layers visible together. Can someone help me tweek the code? Here it is:

       

      var docOCGs = this.getOCGs();

      var f = this.getField("Combo Box19").value;

      for (var x=0; x < docOCGs.length; x++){

      if (f == "(CHILE FTA) 19 USC 1520(d) 19 C.F.R. Part 10.440-10.442")

      {

      docOCGs[x].state = true;

      if(docOCGs[x].name == "CHILE 5")

      {

      docOCGs[x].state = !docOCGs[x].state;

      }

      }

      else if (f == "(NAFTA) Section 520(d) 19 C.F.R. Part 181.31")

      {

      docOCGs[x].state = true;

      if(docOCGs[x].name == "NAFTA 5")

      {

      docOCGs[x].state = !docOCGs[x].state;

      }

      }

      else {

      docOCGs[x].state = false;

      }

      }