$( document ).ready(function() {

  var validationSettings = {
    rules: {
      device_name: {
        required: true
      },
      inching_delay: {
        required: true
      },
      led: {
        required: true
      }
    }
  };

  $.ajax({
         url: '/settings',
         success: function(data) {
           $.each(data, function(key, value, data) {
             var input = "input:text[name='" + key + "']";
             $(input).val(value)
           });
         }
  });

  $.fn.serializeObject = function() {
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
      var input = document.getElementsByName(this.name);
      var value = this.value;
      var dataType = input[0].getAttribute("data-type");
      if (dataType == "number") value = parseFloat(value);
      if (dataType == "boolean") value = value == "on";

      if (o[this.name]) {
        if (!o[this.name].push) {
          o[this.name] = [o[this.name]];
        }
        o[this.name].push(value || '');
      } else {
        o[this.name] = value || '';
      }
    });
    return o;
  };

  $('form').validate(validationSettings);
  $('form').on('submit', function(e) {
    document.getElementById("status").innerHTML = "";
    if($(this).valid()) {
      e.preventDefault();

      var formData = $(this).serializeObject();

      // Send data as a PUT request
      $.ajax({
             url: '/settings',
             type: 'PUT',
             data: JSON.stringify(formData),
             contentType: 'application/json',
             success: function(data) {
               console.log(formData);
               document.getElementById("status").innerHTML = "Settings Updated"
             }
      });

      return false;
    }
  });
});

@@ -388,42 +388,285 @@
 t = 
-%22input:text%5Bname='%22 + key + %22'%5D%22;%0A
+document.getElementsByName(key);%0A             if (input.length %3E 0) %7B%0A               var dataType = input%5B0%5D.getAttribute(%22data-type%22);%0A               if (dataType == %22boolean%22) %7B%0A                 $(input%5B0%5D).prop(%22checked%22, value);%0A                 return%0A               %7D%0A%0A  
     
@@ -681,16 +681,19 @@
  $(input
+%5B0%5D
 ).val(va
@@ -696,16 +696,32 @@
 l(value)
+;%0A             %7D
 %0A       

Set booleans (#71)