JSFiddle - React, Tailwind, and code Playground

by Twisty

HTML

<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<ul>
  <li>
    <label>Select Run:</label>
    <select id="selEditRun">
      <option value="">&nbsp;</option>
      <option value="03/14/2017">Run 1</option>
      <option value="03/15/2017">Run 2</option>
      <option value="03/16/2017">Run 3</option>
      <option value="new">New Run</option>
    </select>
  </li>
  <li>
    <label>Pick Date:</label>
    <input type="text" id="txtEditRunDateTime" />
  </li>
  <li>
    <label>Select Officer:</label>
    <select id="selEditRunDeputies">
      <option value="">&nbsp;</option>
    </select>
  </li>
</ul>

CSS

ul {
  list-style: none;
  padding: 0;
  margin: 3px;
}

ul li label {
  display: inline-block;
  width: 100px;
}

JavaScript

var htmlString = "<option value=''>&nbsp;</option>\n";
htmlString += "<option value='O-1'>Joe Officer</option>";
htmlString += "<option value='O-2'>Sally Officer</option>";
htmlString += "<option value='O-3' disabled='disabled'>Mark Officer</option>";

$(function() {
  $("#txtEditRunDateTime").datepicker();
  $("#selEditRun").change(function() {
    if ($(this).val() !== "" && $(this).val() !== "new") {
      $("#txtEditRunDateTime").datepicker("setDate", $(this).val());
      var id = $(this).val();
      $.ajax({
        url: "/echo/html/",
        dataType: 'html',
        type: "POST",
        data: {
          html: htmlString
        },
        success: function(r) {
          $("#selEditRunDeputies").html(r);
        }
      });
    }
    if ($(this).val() == "new") {
      $("#txtEditRunDateTime").datepicker("setDate", null);
      $("#selEditRunDeputies").find("option").each(function(ind, el) {
        $(el).prop("disabled", false);
      });
    }
  });

  /*
  function populateEditRun() {
    var id = $('#selEditRun').val();
    $.ajax({
      url: 'TCAUServlet'.
      type: 'GET',
      data: {
        formType: 'getRun',
        id: id,
        html: htmlString
      },
      dataType: 'html',
      success: function(responseText) {
        //responseText = $.parseJSON(responseText.html);
        //other field actions removed
        var tmpDate = $('#txtEditRunDateTime').val();
        $.when(updateDisablesLists(tmpDate)).done(function() {
          enableOptions(deputies);
        });
      },
      error: function(request, status, error) {
        alert("An error occurred.  Error:  " + status + ", " + error);
      }
    });
  }

  function updateOfficerWithDisables(d) {
    $.ajax({
      url: 'TCAUServlet',
      type: 'GET',
      data: {
        formType: "getOfficersWithDisables",
        date: d
      },
      dataType: 'html',
      success: function(responseText) {
        $('#selEditRunDeputies').html(responseText);
        //other select...