/*
@author     galih@gmail.com
@author     moe_zhank@yahoo.com
@version    0.1
@copyright  2010
@lib : table list js require jquery.js for now
*/

function jsForm(){
   var obj = new Object();

   this.obj;
   this.id;
   this.name;


   this.combobox = function(dataObj,attr){
      var dom = new DOM('select');
      var select = dom.getObject();

      for(var i in dataObj){
         var opt = new DOM('option');
         opt.setAttribute("value",dataObj[i].id);
         opt.appendText(dataObj[i].name);
         opt.appendTo(select);
      }

      this.obj = select;
   }

   this.setSelected = function(idSelected){
      for(var i=0;i<this.obj.length;i++){
         //
         if(idSelected==this.obj[i].value)
            this.obj.selectedIndex=i;
      }

   }

   this.getObject = function(){
      return this.obj;
   }

   this.setId = function(id){
      this.id = id;
      this.obj.setAttribute('id',id);
   }

   this.setName = function(nameObj){
      this.name = nameObj;
      this.obj.setAttribute('name',nameObj);
   }

   this.getId = function(){
      return this.id;
   }

   this.getName = function(){
      return this.name;
   }
}

