3 Replies Latest reply on Dec 8, 2015 12:03 PM by lukas8330

    Leading zeros while copying values

    lukas8330

      Hi,

       

      I have following code which I use to copy a value from a dropdown list into another text field :

       

      //Set the vars one and two:
                var one = this.getField("Mittlereh");
                var two = this.getField("Text17");
      
                //next check if two is blank and if so, populate it with one’s value
                if(two.value==''||two.value==null){two.value=one.value}
      

       

       

        First thing is...how can I manage it that after choosing a value from the dropdown list it will be changed every time I choose another one. At the moment with that code above I choose only once..and if I want to change it via the dropdown it won't. I have to manually delete the copied value in the text field and then I can choose again. Any ideas ?

       

      And the second..more important issue is that I need also leading zeros. That means I choose e.g. the value "02" from the dropdown, but only "2" is copied into the second field. How can I change that best in my code ?

       

      Thx for help.

       

      Brgds,

      Lukas