Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4171

Get an error when input 01.14.198[1..4] in Datebox

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: 8.6.0.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      I have created Dialog window for date value input:

          public DateDialog(Component parentComponent, String title) {
              super();
              Caption dialogCaption = new Caption(title);
              setWidth("600px");
              setHeight("400px");
              setSclass("dialog");
              setSizable(false);
              setClosable(false);
              setStyle("padding: 10px 10px;");
              setParent(parentComponent);
      
              Label dateLabel = new Label("Input date");
              dateLabel.setHflex("1");
              dateBox = new Datebox();
              dateBox.setFormat("dd.MM.yyyy");
              dateBox.setLenient(false);
              dateBox.setHflex("1");
              dateBox.addEventListener(Events.ON_CHANGE, (SerializableEventListener<Event>) event -> {
                  String errorMessage = dateBox.getErrorMessage();
                  if (errorMessage != null && !errorMessage.trim().isEmpty()) {
                      Messagebox.show("Incorrect date:\n" + errorMessage, "Error", Messagebox.OK, Messagebox.ERROR);
                  }
              });
      
              Hlayout dateLayout = new Hlayout();
              dateLayout.appendChild(dateLabel);
              dateLayout.appendChild(dateBox);
      
              clientLayout = new Vlayout();
              clientLayout.appendChild(dateLayout);
      
              mainLayout = new Vlayout();
              appendChild(dialogCaption);
              appendChild(mainLayout);
              mainLayout.appendChild(getVSplitter());
              mainLayout.appendChild(clientLayout);
              mainLayout.appendChild(getVSplitter());
              initButtons();
          }
      

      So, expecting date format is dd.MM.yyyy. If I input

      • 01.04.1981
      • 01.04.1982
      • 01.04.1983
      • 01.04.1984

      I get an error (see screenshot). But why?
      Other date values seems OK. If I remove

      setLenient(false)
      

      than there is no error.

        Activity

        Hide
        rudyhuang rudyhuang added a comment -

        Hello gooamoko,

        Based on your case, I created http://zkfiddle.org/sample/1qqtimu/1-ZK-4171 fiddle.
        But I can't reproduce the issue.

        Steps:

        1. Click "ru"
        2. Input "01.04.1981"
        3. Blur
        Show
        rudyhuang rudyhuang added a comment - Hello gooamoko , Based on your case, I created http://zkfiddle.org/sample/1qqtimu/1-ZK-4171 fiddle. But I can't reproduce the issue. Steps: Click "ru" Input "01.04.1981" Blur
        Hide
        gooamoko gooamoko added a comment -

        I cat get such behavior only when create dialog box by Java API. In feedles it can't reprodused. I don't know what's the difference.

        Show
        gooamoko gooamoko added a comment - I cat get such behavior only when create dialog box by Java API. In feedles it can't reprodused. I don't know what's the difference.

          People

          • Assignee:
            Unassigned
            Reporter:
            gooamoko gooamoko
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: