       @fetchRecordCount()
 
 
-  checkRequiredFields: (rec) ->
+  checkFields: (rec, type="insert") ->
+    @errorMessage = ''
     for key, col of @_cols()
       dataKey = col.dataKey or key
       if col.required and (not rec[dataKey]? or rec[dataKey] is '')
         col.header = (col.header || key).capitalize()
-        CoffeeAlerts.error("#{col.header} is required")
+        @errorMessage = "#{col.header} is required"
         return false
+      else if type is 'insert' and col.onInsert?
+        rec[dataKey] = col.onInsert()
+      else if type is 'update' and col.onUpdate?
+        rec[dataKey] = col.onUpdate()
     true
 
 

  loadingTemplate : 'ironTableLoading'
  defaultSelect   : {}
  showFilter      : false

  _subscriptionComplete = false
  

              CoffeeAlerts.success(@_recordName() + " created")
              @fetchRecordCount()
      else
        CoffeeAlerts.error("Error could not save new " + @_recordName() + " " + @errorMessage)


  setFilterColumn: (col) ->
