title: JavaFX DatePicker returning null
body: <p>So I looked through questions and found <a href="https://stackoverflow.com/questions/33657521/javafx-datepicker-always-returns-null">this one</a>, which was similar to my problem, but didn't address my issues as I haven't initialized my date pickers in my java file.</p>
  
  <p>I created a date picker. Its fx:id in the fxml file matches its name in the corresponding controller. For some reason, whether I manually type a value or select a date from the calendar, datePicker.getValue() ALWAYS returns null. Can anyone think of why this might be happening?</p>
  
  <p>My code is exactly as the situation I've described here. I have a DatePicker called lowEndDate. I have not initialized it. Upon the click of a button, I want to get its value, but it returns null. Does anyone have any idea why this might be? Perhaps I've missed a step. Thank you.</p>
  
  <p>FXML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.lang.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  &lt;?import javafx.scene.control.Button?&gt;
  &lt;?import javafx.scene.control.Label?&gt;
  &lt;?import javafx.scene.control.ListView?&gt;
  &lt;?import javafx.scene.control.SplitPane?&gt;
  &lt;?import javafx.scene.control.TextArea?&gt;
  &lt;?import javafx.scene.control.TextField?&gt;
  &lt;?import javafx.scene.layout.AnchorPane?&gt;
  &lt;?import javafx.scene.text.Font?&gt;
  
  &lt;SplitPane dividerPositions="0.22122571001494767" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="395.0" prefWidth="671.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.UserMainController"&gt;
    &lt;items&gt;
      &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="398.0" prefWidth="175.0"&gt;
           &lt;children&gt;
              &lt;Button fx:id="logOut" layoutX="35.0" layoutY="261.0" mnemonicParsing="false" onAction="#logOutButtonClicked" text="Log Out"&gt;
                 &lt;font&gt;
                    &lt;Font size="15.0" /&gt;
                 &lt;/font&gt;
              &lt;/Button&gt;
              &lt;Label layoutX="52.0" layoutY="44.0" text="user:"&gt;
                 &lt;font&gt;
                    &lt;Font size="19.0" /&gt;
                 &lt;/font&gt;
              &lt;/Label&gt;
              &lt;Label fx:id="username" layoutX="16.0" layoutY="76.0" prefHeight="32.0" prefWidth="116.0" textAlignment="CENTER"&gt;
                 &lt;font&gt;
                    &lt;Font size="25.0" /&gt;
                 &lt;/font&gt;
              &lt;/Label&gt;
           &lt;/children&gt;&lt;/AnchorPane&gt;
      &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="442.0" prefWidth="457.0"&gt;
           &lt;children&gt;
              &lt;ListView fx:id="albumListView" layoutY="-2.0" prefHeight="335.0" prefWidth="292.0" /&gt;
              &lt;Button fx:id="deleteButton" layoutX="115.0" layoutY="348.0" mnemonicParsing="false" onAction="#deleteButtonClicked" prefHeight="31.0" prefWidth="68.0" text="Delete"&gt;
                 &lt;font&gt;
                    &lt;Font size="15.0" /&gt;
                 &lt;/font&gt;
              &lt;/Button&gt;
              &lt;AnchorPane layoutX="292.0" prefHeight="335.0" prefWidth="169.0"&gt;
                 &lt;children&gt;
                    &lt;Label fx:id="albums" layoutX="73.0" layoutY="44.0" text="Albums"&gt;
                       &lt;font&gt;
                          &lt;Font size="22.0" /&gt;
                       &lt;/font&gt;
                    &lt;/Label&gt;
                    &lt;Label fx:id="addSuccess" layoutX="99.0" layoutY="212.0" text="ADD SUCCESSFUL" textFill="#2bee34" visible="false" /&gt;
                    &lt;Label fx:id="addFail" layoutX="81.0" layoutY="212.0" text="ALBUM EXISTS. TRY AGAIN" textFill="#d01313" visible="false" /&gt;
                    &lt;AnchorPane fx:id="createAlbumAnchor" layoutY="7.0" prefHeight="335.0" prefWidth="169.0" visible="false"&gt;
                       &lt;children&gt;
                          &lt;Label layoutX="46.0" layoutY="39.0" text="Create Album"&gt;
                             &lt;font&gt;
                                &lt;Font size="22.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Label&gt;
                          &lt;Button fx:id="albumCreate" layoutX="46.0" layoutY="229.0" mnemonicParsing="false" onAction="#OKButtonClicked" text="OK"&gt;
                             &lt;font&gt;
                                &lt;Font size="15.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Button&gt;
                          &lt;Button fx:id="back" layoutX="121.0" layoutY="229.0" mnemonicParsing="false" onAction="#backButtonClicked" text="Back"&gt;
                             &lt;font&gt;
                                &lt;Font size="15.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Button&gt;
                          &lt;TextField fx:id="newAlbumName" layoutX="38.0" layoutY="115.0" promptText="Album name" /&gt;
                          &lt;Label fx:id="mustInputText" layoutX="64.0" layoutY="160.0" text="MUST INPUT TEXT" textFill="#cd1515" visible="false" /&gt;
                       &lt;/children&gt;
                    &lt;/AnchorPane&gt;
                    &lt;AnchorPane fx:id="searchAnchor" layoutX="4.0" layoutY="7.0" prefHeight="321.0" prefWidth="212.0"&gt;
                       &lt;children&gt;
                          &lt;Label layoutX="74.0" layoutY="35.0" text="Search"&gt;
                             &lt;font&gt;
                                &lt;Font size="22.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Label&gt;
                          &lt;Label layoutX="76.0" layoutY="67.0" text="Date Range" /&gt;
                          &lt;Label layoutX="91.0" layoutY="123.0" text="to" /&gt;
                          &lt;Label layoutX="91.0" layoutY="185.0" text="Tags" /&gt;
                          &lt;TextArea fx:id="tags" layoutX="24.0" layoutY="208.0" prefHeight="71.0" prefWidth="166.0" promptText="ex: healthy,happy,nyc" /&gt;
                          &lt;Button fx:id="searchOK" layoutX="48.0" layoutY="282.0" mnemonicParsing="false" onAction="#searchOKButtonClicked" text="OK" /&gt;
                          &lt;Button fx:id="searchBack" layoutX="118.0" layoutY="282.0" mnemonicParsing="false" onAction="#searchBackButtonClicked" text="Back" /&gt;
                          &lt;DatePicker fx:id="highEndDate" layoutX="20.0" layoutY="92.0" promptText="dd/mm/yyyy" /&gt;**
                          &lt;DatePicker fx:id="lowEndDate" layoutX="20.0" layoutY="148.0" promptText="dd/mm/yyyy" /&gt;
                       &lt;/children&gt;
                    &lt;/AnchorPane&gt;
                 &lt;/children&gt;
              &lt;/AnchorPane&gt;
              &lt;Button fx:id="createButton" layoutX="21.0" layoutY="348.0" mnemonicParsing="false" onAction="#createButtonClicked" text="Create"&gt;
                 &lt;font&gt;
                    &lt;Font size="15.0" /&gt;
                 &lt;/font&gt;
              &lt;/Button&gt;
              &lt;Button fx:id="searchButton" layoutX="212.0" layoutY="348.0" mnemonicParsing="false" onAction="#searchButtonClicked" text="Search"&gt;
                 &lt;font&gt;
                    &lt;Font size="15.0" /&gt;
                 &lt;/font&gt;
              &lt;/Button&gt;
           &lt;/children&gt;&lt;/AnchorPane&gt;
    &lt;/items&gt;
  &lt;/SplitPane&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>public void searchOKButtonClicked(ActionEvent e){
          boolean searchComplete = false;
          User currentUser = LoginController.currentUser;
          if((lowEndDate.getValue() == null) &amp;&amp; (highEndDate.getValue() == null) &amp;&amp; ((tags == null) || tags.getText().trim().isEmpty())){
              Alert alert = new Alert(AlertType.ERROR);
              alert.setContentText("Oops! At least one field is required to search.");
              alert.show();
          }
  
  }
  </code></pre>
  
  <p>The trouble here: lowEndDate and highEndDate are ALWAYS null, regardless of input.</p>