     #
     
     #$scope.defaultValue[1] = 3;
-    #
-    #    submit, save, refresh...
-    #
-    $scope.submit = ->
+    
+    #get options for select
+    get_kv = (field) ->
+    
+        dataService.getkv(params).then(
+            (data) ->
+                $log.debug(data)
+            ,
+            (result) ->
+                $log.debug("error", data)
+        
+        )
+    
+    # initial all select field
+    init_select = ->
+        
+        select_fields = []
+        
+        for field in select_fields
+            
+            get_kv(field)
+    
+    #set value for $scope.system
+    set_sysdata = (data) ->
+        
+        cols = ["modifiedon","modifiedby","createdon","createdby","rowversion"]
+        
+        for col in cols
+            $scope.system[col] = data[col]
+    
+    # get data for edit
+    $scope.get = ->
+    
+    
+        dataService.get(params).then(
+            (data) ->
+                $log.debug(data)
+                $scope.defaultValue[0] = "abc"
+            ,
+            (result) ->
+                $log.debug("error", result)        
+        
+        
+        )    
+    # refresh data from db
+    $scope.refresh = ->
+        
+        $scope.get()
+    
+    #
+    # submit, save, refresh...
+    #
+    $scope.save = ->
         #$validator.validate($scope, "zform").success(->
         #zmodel
+        
+        #$scope.zmodel[0].value = "abc"
+        #$scope.defaultValue[0] = "abc";
         
         fields = {}
         

      ${default}
      
%endfor
    
    # object list / initial position
    obj_list = [

                fields[item.name] = item.value
        
        params = 
            table: $scope.table
            pkey: $scope.pkey
            columns:fields
            context: context


