   localStorage[collection] = true
   for child in $('#collection_form').children()
     if $(child).attr('id') && !$(child).prop('disabled') && ($(child).attr('type') != 'hidden')
-      localStorage["#{collection}:#{$(child).attr('id')}"] = $(child).val()
+      localStorage["#{collection}:#{$(child).attr('id')}"] = get_value_for_form_input(child)
   $('#collection_form').after $('<div>').attr('class','alert alert-success').attr('id','save_success').append('Saved.')
   $('#save_success').fadeOut 1800, ->
     $(this).remove()

  if localStorage[collection]
    for child in $('#collection_form').children()
      if $(child).attr('id') && localStorage["#{collection}:#{$(child).attr('id')}"]?
        $(child).val(localStorage["#{collection}:#{$(child).attr('id')}"])

clear_collection_form = ->
  collection = $('#collection_select').val()

    for child in $('#collection_form').children()
      if $(child).attr('id') && ($(child).attr('type') != 'hidden')
        column_names.push fusion_tables_escape($(child).attr('id'))
        row_values.push fusion_tables_escape(get_value_for_form_input(child))
    fusion_tables_query "INSERT INTO #{collection} (#{column_names.join(', ')}) VALUES (#{row_values.join(', ')})", (data) ->
      clear_collection_form()
      $('#collection_form').after $('<div>').attr('class','alert alert-success').attr('id','submit_success').append('Submitted.')
