title: How do I capture a jquery mobile slider value in parse.com?
body: <p>I'm using jquery mobile to capture data and send to parse.com. The below code is the form being used.</p>
  
  <p>I'm able to capture the BPsystolic and BPDiastolic data without issue. However I've noticed that only when the "Have you eaten in the last 2 hours?" slider is set to "YES" is the data being captured in the parse database.</p>
  
  <p>My question is how do I capture the slider value when its set to "NO" ?</p>
  
  <p>FORM CODE</p>
  
  <pre><code>&lt;div data-role="page" id="page1"&gt;
      &lt;div data-role="content"&gt;
          &lt;form id="healthform"&gt;
              &lt;div data-role="fieldcontain"&gt;
                  &lt;label for="eatentime"&gt;
                      Have you eaten in the last 2 hours?
                  &lt;/label&gt;
                  &lt;select name="toggleswitch1" id="eatentime" data-role="slider"
                  data-mini="true"&gt;
                      &lt;option value="off"&gt;
                          Yes
                      &lt;/option&gt;
                      &lt;option value="on"&gt;
                          No
                      &lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div data-role="fieldcontain"&gt;
                  &lt;label for="BPsystolic"&gt;
                      Blood Pressure - Systolic (Top)
                  &lt;/label&gt;
                  &lt;input name="BPsystolic" id="BPsystolic" value="" type="number"
                  data-mini="true"&gt;
              &lt;/div&gt;
              &lt;div data-role="fieldcontain"&gt;
                  &lt;label for="BPDiastolic"&gt;
                      Blood Pressure - Diastolic (Bottom)
                  &lt;/label&gt;
                  &lt;input name="BPDiastolic" id="BPDiastolic" value="" type="number"
                  data-mini="true"&gt;
              &lt;/div&gt;
  
              &lt;input type="submit" value="Upload Data"&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>CODE TO SEND DATA TO PARSE</p>
  
  <pre><code>&lt;script&gt;
  
  var SightingObject;
  var db;
  
  function errorCB(e) {
      //We should do something here - the database isn't technically required per se, but it should
      //work. 
      console.log("DB Error");
      console.dir(e);
  }
  
  function online() {
      //return false;
      return navigator.onLine;
  }
  
  $(document).ready(function() {
  
      //initialize db
      db = window.openDatabase("sightingdb", "1.0", "Sighting Database", 200000);
      db.transaction(createDB, errorCB, initApp);
  
      function createDB(trans) {
          trans.executeSql("create table if not exists sighting(id INTEGER PRIMARY KEY,BPDiastolic,BPsystolic,eatentime)");
      }
  
  });
  
  /*
  I'm run after the db is setup. 
  */
  function initApp() {
  
      if(online()) {
          Parse.initialize("x", "x");
          SightingObject = Parse.Object.extend("SightingObject");
  
          //do we have existing objects in the db we can upload?
          db.transaction(function(trans) {
              trans.executeSql("select * from sighting", [], function(trans,result) {
                  //do we have rows?
                  if(result.rows.length &gt; 0) {
                      console.log("Ok, we need to push stuff up");
                      for(var i=0, len=result.rows.length; i&lt;len; i++) {
                          var row = result.rows.item(i);
  
                          (function(row) {
                              //Parse will try to save everything, including ID, so make a quick new ob
                              var report = {};
                                  report.BPDiastolic = row.BPDiastolic; 
                                  report.BPsystolic = row.BPsystolic; 
                                  report.eatentime = row.eatentime; 
  
  
                              saveToParse(report, function() { 
                                  console.log("i need to delete row "+row.id);
                                  db.transaction(function(trans) {
                                      trans.executeSql("delete from sighting where id = ?", [row.id]);
                                  }, errorCB);
                              });
                          }(row));
  
                      }
                  }
              },errorCB);
          }, errorCB, function() {
              console.log("Done uploading the old rows");
          });
      }
  
      $("#healthform").on("submit", function(e) {
          e.preventDefault();
          /*
          gather the values - normally we'd do a bit of validation, but since UFO chasers
          are known for their rigorous and rational pursuit of science, this will not be necessary
          */
          var report = {};
              report.BPDiastolic = $("#BPDiastolic").val();
              report.BPsystolic = $("#BPsystolic").val();
              report.eatentime = $("#eatentime").val();
  
          console.log("To report: ",report);
          //ok, disable the form while submitting and show a loading gfx
          $(this).attr("disabled","disabled");
          $("#loadingGraphic").show();
  
          if(online()) {
              console.log("I'm online, send to parse");
              saveToParse(report,resetForm);
          } else {
              console.log("I'm offline, save to WebSQL");
              db.transaction(function(trans) {
                  trans.executeSql("insert into sighting(BPDiastolic,BPsystolic,eatentime) values(?,?,?)", [report.BPDiastolic,report.BPsystolic,report.eatentime]);
              }, errorCB, resetForm);
          }
      });
  
  };
  
  function saveToParse(ob,successCB) {
      var sightingObject = new SightingObject();
      sightingObject.save(ob, {
          success: function(object) {
              console.log("Saved to parse.");
              console.dir(object);
              successCB(object);
          },
          error: function(model, error) {
              console.log("Error!");
              console.dir(error);
          }
      });
  }
  
  //handles removing the disabled form stuff and loading gfx
  function resetForm() {
      $("#BPDiastolic").val(""); 
      $("#BPsystolic").val(""); 
      $("#eatentime").val("");
      $("#sightForm").removeAttr("disabled","disabled");
      $("#loadingGraphic").hide();
      var status = $("#status");
      if(online()) {
          status.fadeIn().html("Your data has been saved!").fadeOut(4000);
      } else {
          status.fadeIn().html("Your data has been saved locally and will be uploaded next time you are online!").fadeOut(4000);
      }
  }
  
  &lt;/script&gt;
  </code></pre>