Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8177114

[WebView] Implement HTML5 Input Type: Date

XMLWordPrintable

    • web
    • generic
    • generic

      HTML5 Input Type : Date
      Currently Input type is supported in Chrome, Opera and Edge. (Ref : http://caniuse.com/#feat=input-datetime)

      FULL PRODUCT VERSION :
      java version "1.8.0_112"
      Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Applies to all platforms

      A DESCRIPTION OF THE PROBLEM :
      I'm trying to display an input type="date" in JavaFX WebView, but the input is rendered as a normal TextField.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      View in a Browser and compare to same HTML loaded in WebView:
      <html>
          <body>
              <form>
                  Birthday:
                  <input type="date" name="bday">
              </form>
          </body>
      </html>

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      WebView should render a date spinner.
      ACTUAL -
      WebView renders a textfield

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.StackPane;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;


      public class Bugreportdatefield extends Application {

          @Override
          public void start(Stage primaryStage) {
              WebView webView = new WebView();
              webView.getEngine().loadContent("<html>\n"
                      + " <body>\n"
                      + " <form>\n"
                      + " Birthday:\n"
                      + " <input type=\"date\" name=\"bday\">\n"
                      + " </form>\n"
                      + " </body>\n"
                      + "</html>");
              Scene scene = new Scene(webView, 300, 250);

              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
          }

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }

      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: