2 Replies Latest reply on Aug 31, 2014 8:01 PM by kulshreshtha

    populate a listbox using javascript

    kulshreshtha

      I want to populate a list box using Javascript .

      I have a  following script:

       

      // Place all prepopulation data into a single data structure

      var TrainData = { 12002:{ StationFrom: "New Delhi", StationTo: "Bhopal", Stn: ["MTJ", "AGC"]

      },

                       12004:{ StationFrom: "NDLS", StationTo: "Lucknow" }};

      function SetFieldValues(cTrainName)

      {

        this.getField("TrainFromName").value = TrainData[cTrainName].StationFrom;

      this.getField("TrainToName").value = TrainData[cTrainName].StationTo;

      this.getField("TrainStn").value = TrainData[cTrainName].Stn;

       

       

      }

      I'm able to get data (MTJ, AGC) using this.getField("TrainStn").value = TrainData[cTrainName].Stn; to a text box

      whereas i require this data into a list box.

      Let me know how to do this?