ICEfaces
  1. ICEfaces
  2. ICE-1865

<ice:selectInputDate> ignores the disabled attribute

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6, 1.6.1
    • Fix Version/s: 1.6.1, 1.7DR#1, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      OS: Windows; Browser: All;
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      Although the fix doesn't seem to be very difficult, we refrained from altering the icefaces jar so we created our own SelectInputDateRenderer.java which subclasses icefaces' SelectInputDateRenderer.java. There we overroad the public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException method. Here is the code:

      <code>

      public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
      throws IOException {

      super.encodeEnd(facesContext, uiComponent);

      DOMContext domContext = DOMContext.attachDOMContext(facesContext, uiComponent);
      SelectInputDate selectInputDate = (SelectInputDate)uiComponent;

      Node rootNode = domContext.getRootNode();
      Element inputNode = (Element)rootNode.getFirstChild();
      Element calendarButton = (Element)inputNode.getNextSibling();

      if (selectInputDate.isDisabled()) {
      inputNode.setAttribute(HTML.DISABLED_ATTR, "true");
      }

      if (selectInputDate.isDisabled()) {
      calendarButton.setAttribute(HTML.DISABLED_ATTR, "true");
      }
      }

      </code>
      Show
      Although the fix doesn't seem to be very difficult, we refrained from altering the icefaces jar so we created our own SelectInputDateRenderer.java which subclasses icefaces' SelectInputDateRenderer.java. There we overroad the public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException method. Here is the code: <code> public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException { super.encodeEnd(facesContext, uiComponent); DOMContext domContext = DOMContext.attachDOMContext(facesContext, uiComponent); SelectInputDate selectInputDate = (SelectInputDate)uiComponent; Node rootNode = domContext.getRootNode(); Element inputNode = (Element)rootNode.getFirstChild(); Element calendarButton = (Element)inputNode.getNextSibling(); if (selectInputDate.isDisabled()) { inputNode.setAttribute(HTML.DISABLED_ATTR, "true"); } if (selectInputDate.isDisabled()) { calendarButton.setAttribute(HTML.DISABLED_ATTR, "true"); } } </code>

      Description

      Hi. I found a most intriguing issue. The <ice:selectInputDate> seems to ignore the disabled attribute. I've taken a look in the generated html code and the generated <input> indeed has no disabled attribute. The fix is easy I think. I took a look in icefaces' source code and found out that the disabled attribute is not taken into consideration: com.icesoft.faces.component.selectinputdate.SelectInputDateRenderer, method public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException; The simplest thing in my opinion would be to do the following:

      <code>

      Element dateText = domContext.createElement(HTML.INPUT_ELEM);
      dateText.setAttribute(HTML.VALUE_ATTR, selectInputDate.formatDate((Date)selectInputDate.getValue()));
      dateText.setAttribute(HTML.ID_ATTR, clientId + CALENDAR_INPUTTEXT);
      dateText.setAttribute(HTML.NAME_ATTR, clientId + CALENDAR_INPUTTEXT);
      dateText.setAttribute(HTML.CLASS_ATTR, selectInputDate.getCalendarInputClass());
      dateText.setAttribute(HTML.ONFOCUS_ATTR, "setFocus('');");
      dateText.setAttribute("onkeypress", this.ICESUBMIT);
      dateText.setAttribute(HTML.ONBLUR_ATTR, this.ICESUBMITPARTIAL);

      //my code
      if (selectInputDate.isDisabled()) {
      dateText.setAttribute(HTML.DISABLED_ATTR, "true");
      }

      if (selectInputDate.getAutocomplete() != null) {
      dateText.setAttribute("autocomplete", selectInputDate.getAutocomplete());
      }

      // extract the popupdate format and use it as a tooltip
      String tooltip = selectInputDate.getPopupDateFormat();
      dateText.setAttribute(HTML.TITLE_ATTR, "Date Format: " + tooltip);
      root.appendChild(dateText);

      Element calendarButton = domContext.createElement(HTML.INPUT_ELEM);
      calendarButton.setAttribute(HTML.ID_ATTR, clientId + CALENDAR_BUTTON);
      calendarButton.setAttribute(HTML.NAME_ATTR, clientId + CALENDAR_BUTTON);
      calendarButton.setAttribute(HTML.TYPE_ATTR, "image");

      //my code
      if (selectInputDate.isDisabled()) {
      calendarButton.setAttribute(HTML.DISABLED_ATTR, "true");
      }

      </code>

        Activity

        Radu Andrei Tanasa created issue -
        Hide
        Michael Thiem added a comment -

        This is still reoccurring in 1.6.1, neither the disabled nor the readonly attributes have any effect on the selectInputDate

        Show
        Michael Thiem added a comment - This is still reoccurring in 1.6.1, neither the disabled nor the readonly attributes have any effect on the selectInputDate
        Michael Thiem made changes -
        Field Original Value New Value
        ICEfaces Forum Reference http://www.icefaces.org/JForum/posts/list/5517.page
        Affects Version/s 1.6.1 [ 10070 ]
        Michael Thiem made changes -
        Assignee Adnan Durrani [ adnan.durrani ]
        Adnan Durrani made changes -
        Assignee Adnan Durrani [ adnan.durrani ] Yip Ng [ yip.ng ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14800 Fri Sep 07 15:58:11 MDT 2007 yip.ng ICE-1865
        Added code to set the value of the disabled attribute for the links, input fields and buttons in the calendar component.
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14801 Fri Sep 07 15:59:29 MDT 2007 yip.ng ICE-1865
        Added code to set the value of the disabled attribute for the links, input fields and buttons in the calendar component.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java
        Hide
        yip.ng added a comment -

        Set the disabled attribute of the constituent controls in both types of calendar components.
        As per the the XHTML spec., value of attribute is set to "disabled" rather than "true".

        Show
        yip.ng added a comment - Set the disabled attribute of the constituent controls in both types of calendar components. As per the the XHTML spec., value of attribute is set to "disabled" rather than "true".
        yip.ng made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.7DR#1 [ 10100 ]
        Fix Version/s 1.6.1 [ 10070 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #14993 Fri Oct 19 17:41:31 MDT 2007 mark.collette Backport to 1.6.2 : ICE-1865, ICE-2082, ICE-2095, ICE-2150, ICE-2127
        Files Changed
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/samples/component-showcase/src/com/icesoft/icefaces/samples/showcase/components/calendar/SelectInputDateBean.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/core/src/com/icesoft/faces/resources/css/royale/royale.css
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/CSS_DEFAULT.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/samples/component-showcase/web/inc/components/selectInputDate.jspx
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/core/src/com/icesoft/faces/resources/css/xp/xp-portlet.css
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/selectinputdate/SelectInputDate.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-selectInputDate-props.xml
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/core/src/com/icesoft/faces/resources/css/xp/xp.css
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/util/CustomComponentUtils.java
        Commit graph MODIFY /icefaces/branches/icefaces-1.6/icefaces/component/src/com/icesoft/faces/component/selectinputdate/SelectInputDateRenderer.java
        Ken Fyten made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Ken Fyten made changes -
        Fix Version/s 1.7 [ 10080 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Yip Ng [ yip.ng ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22415 Fri Sep 24 08:36:50 MDT 2010 yip.ng ICE-6058: Regression Icefaces2: ICE-1865 calendar popup button not visible.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/resources/css/xp/xp-portlet.css
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/resources/css/xp/xp.css
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/resources/css/woodstock/woodstock.css
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/resources/css/royale/royale.css
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/resources/css/rime/rime.css
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/resources/css/rime/rime-portlet.css
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22416 Fri Sep 24 08:37:50 MDT 2010 yip.ng ICE-6058: Regression Icefaces2: ICE-1865 calendar popup button not visible.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/core/src/main/resources/css/com/icesoft/faces/resources/css/rime/rime.css
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/core/src/main/resources/css/com/icesoft/faces/resources/css/rime/rime-portlet.css
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/core/src/main/resources/css/com/icesoft/faces/resources/css/xp/xp-portlet.css
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/core/src/main/resources/css/com/icesoft/faces/resources/css/royale/royale.css
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/core/src/main/resources/css/com/icesoft/faces/resources/css/xp/xp.css

          People

          • Assignee:
            Unassigned
            Reporter:
            Radu Andrei Tanasa
          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: