         callback: (data) ->
           if data
             $el = @$element
+            tsFieldTypes = $el.data('tsFieldTypes')
             model = window.TS.getModel $el.data('ts-url')
           
             vex.dialog.confirm

              callback: (value) ->
                if value
                  for k,v of data
                    model.set(k, { field: k, value: v, type: if $.isArray(v) then 'multiple_select' else 'text' })
                  model.save ->
                    window.location.reload()


        select 
    inputs += "<div class'vex-custom-field-wrapper'>#{label}<div class='vex-custom-input-wrapper'>#{input}</div></div>"

  element.data('tsFieldTypes', tsFieldTypes)
  inputs

class window.TS.EditPage
