ICEfaces
  1. ICEfaces
  2. ICE-5158

Odd dates of selectInputDate component trigger validation of other fields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.8.2-EE-GA, 1.8.3
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      All

      Description

      Selecting an odd date (not even) on a selectInputDate triggers validation of the other fields in the page when immediate is set to true. The same thing happens for the "Show previous month" and "Show previous year" buttons. When selecting an even date, "Show next month" or "Show next year" everything works as expected.

      main.xhtml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ice="http://www.icesoft.com/icefaces/component">
      <head>
      <title>Test</title>
      <ice:outputStyle href="xmlhttp/css/rime/rime.css" />
      </head>
      <body>
      <ice:form partialSubmit="false" id="Form">
      <ice:panelGrid columns="3">
      <ice:inputText value="#{bean.text}" id="Text" required="true">
      <f:validateLength minimum="2" />
      </ice:inputText>
      <ice:selectInputDate value="#{bean.date}" renderAsPopup="false" partialSubmit="false" id="Date" immediate="true" />
      <ice:selectOneListbox value="#{bean.item}" size="1" required="true" id="Combo">
      <f:selectItem itemLabel="Select..." itemValue="-1" />
      <f:selectItem itemLabel="0" itemValue="0" />
      <f:selectItem itemLabel="1" itemValue="1" />
      <f:selectItem itemLabel="2" itemValue="2" />
      <f:validateLongRange minimum="0" />
      </ice:selectOneListbox>
      </ice:panelGrid>
      <ice:commandButton actionListener="#{bean.submit}" value="Submit" />
      <br />
      <ice:outputText value="Text: #{bean.text}&lt;br/&gt;Date: #{bean.date}&lt;br/&gt;Item: #{bean.item}" escape="false" />
      </ice:form>

      <ice:messages />
      </body>
      </html>

      Bean.java

      package org.local.test;

      import java.util.Date;

      import javax.faces.event.ActionEvent;

      public class Bean {
      private String text;
      private Date date;
      private Integer item;

      public String getText() {
      return text;
      }

      public void setText(String text) {
      this.text = text;
      }

      public Date getDate() {
      return date;
      }

      public void setDate(Date date) {
      this.date = date;
      }

      public Integer getItem() {
      return item;
      }

      public void setItem(Integer item) {
      this.item = item;
      }

      public void submit(ActionEvent ae) {
      System.err.println("submit");
      }
      }

        Activity

        Dumitru Ban created issue -
        Hide
        Dumitru Ban added a comment -

        The issue is caused by the removal of every other child component of the selectInputDate component. This is happening in the encodeEnd method in the following lines:

        // purge child components as they have been encoded no need to keep them around
        selectInputDate.getChildren().removeAll(selectInputDate.getChildren());

        This fails to remove all the children as it was probably intended. It goes in UIComponentBase's method:

        public boolean removeAll(Collection<?> collection) {
        boolean result = false;
        Iterator<?> elements = collection.iterator();
        while (elements.hasNext()) {
        if (remove(elements.next()))

        { result = true; }

        }
        return (result);
        }

        and removes every other child component.

        Fixing this by calling selectInputDate.getChildren().clear(); generalizes the problem to all children including the even dates and "Show next month" or "Show next year" buttons.

        The proper fix is to leave the child components in place because they are used later by the decode method that goes through all facets and children in order to queue the needed events.

        Show
        Dumitru Ban added a comment - The issue is caused by the removal of every other child component of the selectInputDate component. This is happening in the encodeEnd method in the following lines: // purge child components as they have been encoded no need to keep them around selectInputDate.getChildren().removeAll(selectInputDate.getChildren()); This fails to remove all the children as it was probably intended. It goes in UIComponentBase's method: public boolean removeAll(Collection<?> collection) { boolean result = false; Iterator<?> elements = collection.iterator(); while (elements.hasNext()) { if (remove(elements.next())) { result = true; } } return (result); } and removes every other child component. Fixing this by calling selectInputDate.getChildren().clear(); generalizes the problem to all children including the even dates and "Show next month" or "Show next year" buttons. The proper fix is to leave the child components in place because they are used later by the decode method that goes through all facets and children in order to queue the needed events.
        Dumitru Ban made changes -
        Field Original Value New Value
        Attachment SelectInputDateRenderer.patch.txt [ 12102 ]
        Ken Fyten made changes -
        Salesforce Case []
        Fix Version/s 1.8.2-EE-GA [ 10216 ]
        Fix Version/s 1.8.3 [ 10211 ]
        Assignee Priority P1
        Assignee Yip Ng [ yip.ng ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19794 Thu Nov 26 10:33:24 MST 2009 yip.ng ICE-5158: Fixed bug of date selection triggering validation of other fields, with patch submitted by Dumitru Ban.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java
        Hide
        yip.ng added a comment -

        Fixed as suggested.

        Show
        yip.ng added a comment - Fixed as suggested.
        yip.ng made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #20968 Mon Mar 15 17:46:27 MDT 2010 mark.collette ICE-5384 : ICE-5158 built with just-ice
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P1
        Assignee Yip Ng [ yip.ng ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Dumitru Ban
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: