Variable Drop Down Issue.


i trying set 3 drop down lists same values master list. can set 1 field if add additional line code , call out additional fields syntax error.

 

here 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 else works after if statement cannot have more 1 line. if close in {} allows me use seems repect line 1 after if statement.

does 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();

 

        }

 

}



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support