ICEfaces
  1. ICEfaces
  2. ICE-2351

selectInputDate problems with clearing the date

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.2, 1.7DR#2
    • Fix Version/s: 1.6.2, 1.7DR#3, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Win XP SP2, component-showcase

      Description

      Some comments in the JForum posting, as well as comments by Sheng Gu in ICE-1343 led me to investigate ice:selectInputDate. Here are the issues that I found. I'm putting these in a single Jira because I think it'll just be a huge hassle trying to address and commit these issues separately.

      1. Can't clear out the text field to make no date selected. Select a date, and see that it validates, and is set into the bean. Then go clear out the text field, and tab away. It gets a null submittedValue, but the value does not become null, and the bean does not get the null value.

      2. If you try to implement a Cancel button by setting immediate="true" on it, and having its actionListener null out values in the bean, it won't work with selectInputDate, because clicking on the button will also submit the form, and cause a series of interactions that will result in the date existing again. Amusingly enough, it will work with imediate="false".

        Activity

        Hide
        Sheng Gu added a comment -

        Hi Mark,

        As I ever stated, my popup panel is not selectInputDate component. It is just a popup panel. The partial code snippet is as follows:
        =======================================================================================
        <!-- panel popup code, modal type -->
        <ice:panelPopup id="popupDiv"
        rendered="#

        {adminScheduleHandler.showEditor}"
        visible="#{adminScheduleHandler.showEditor}

        "
        draggable="true"
        style="z-index:1001; width: 370px; height: 300px; top: 300px; left: 300px; position: absolute;">

        <f:facet name="header">
        <ice:outputText styleClass="popupTitle"
        value="Admin Schedule Editor"/>
        </f:facet>

        <f:facet name="body">
        <ice:panelGrid width="100%" cellpadding="0"
        cellspacing="0" columns="1"
        rendered="#

        {adminScheduleHandler.showEditor}

        "
        styleClass="popupLayoutGridStyle"
        style="z-index:2;">

        <!-- ======================= new entries =========================== -->
        <ice:panelGrid columns="2" id="newEntries" rendered="#

        {adminScheduleHandler.new}"
        columnClasses="rightCol, leftCol">

        <ice:outputText value="Start Time:" />
        <ice:panelGroup>
        <ice:selectOneMenu styleClass="selectTagMenu"
        value="#{adminScheduleHandler.startHour}"
        style="width:50px;">
        <f:selectItems value="#{adminScheduleHandler.hourItems}"/>
        </ice:selectOneMenu>
        <ice:outputText value=": " />
        <ice:selectOneMenu styleClass="selectTagMenu"
        value="#{adminScheduleHandler.startMin}"
        style="width:50px;">
        <f:selectItems value="#{adminScheduleHandler.minItems}"/>
        </ice:selectOneMenu>
        <ice:selectOneMenu styleClass="selectTagMenu"
        value="#{adminScheduleHandler.startAmpm}"
        style="width:50px;">
        <f:selectItems value="#{adminScheduleHandler.ampmItems}"/>
        </ice:selectOneMenu>
        </ice:panelGroup>


        <ice:outputLabel for="interval1" value="Interval:" />
        <ice:panelGroup>
        <ice:selectOneMenu id="interval1" styleClass="selectTagMenu"
        value="#{adminScheduleHandler.interval}"
        style="width:120px;">
        <f:selectItems value="#{adminScheduleHandler.intervalItems}"/>
        </ice:selectOneMenu>
        <ice:message for="interval1" />
        </ice:panelGroup>
        </ice:panelGrid>

        <ice:panelGroup style="text-align: center; width:100%;">
        <ice:commandButton actionListener="#{adminScheduleHandler.cancelEditor}"
        style="z-index:2;" value="Cancel" />
        <ice:commandButton action="#{adminScheduleHandler.createEntries}"
        value="Create Entries" rendered="#{adminScheduleHandler.new}

        "
        style="z-index:2;"/>
        </ice:panelGroup>
        ......

        public void scheduleClicked(ScheduleMouseEvent event) {
        switch (event.getEventType())

        { case ScheduleMouseEvent.SCHEDULE_BODY_CLICKED: log.info("time=" + event.getClickedTime().toString()); startTime = event.getClickedTime(); Calendar calendar = GregorianCalendar.getInstance(); if (startTime == null) startTime = new Date(); calendar.setTime(startTime); startHour = calendar.get(Calendar.HOUR); startMin = calendar.get(Calendar.MINUTE); startAmpm = calendar.get(Calendar.AM_PM); isNew = true; showEditor = true; break; .... }
        Show
        Sheng Gu added a comment - Hi Mark, As I ever stated, my popup panel is not selectInputDate component. It is just a popup panel. The partial code snippet is as follows: ======================================================================================= <!-- panel popup code, modal type --> <ice:panelPopup id="popupDiv" rendered="# {adminScheduleHandler.showEditor}" visible="#{adminScheduleHandler.showEditor} " draggable="true" style="z-index:1001; width: 370px; height: 300px; top: 300px; left: 300px; position: absolute;"> <f:facet name="header"> <ice:outputText styleClass="popupTitle" value="Admin Schedule Editor"/> </f:facet> <f:facet name="body"> <ice:panelGrid width="100%" cellpadding="0" cellspacing="0" columns="1" rendered="# {adminScheduleHandler.showEditor} " styleClass="popupLayoutGridStyle" style="z-index:2;"> <!-- ======================= new entries =========================== --> <ice:panelGrid columns="2" id="newEntries" rendered="# {adminScheduleHandler.new}" columnClasses="rightCol, leftCol"> <ice:outputText value="Start Time:" /> <ice:panelGroup> <ice:selectOneMenu styleClass="selectTagMenu" value="#{adminScheduleHandler.startHour}" style="width:50px;"> <f:selectItems value="#{adminScheduleHandler.hourItems}"/> </ice:selectOneMenu> <ice:outputText value=": " /> <ice:selectOneMenu styleClass="selectTagMenu" value="#{adminScheduleHandler.startMin}" style="width:50px;"> <f:selectItems value="#{adminScheduleHandler.minItems}"/> </ice:selectOneMenu> <ice:selectOneMenu styleClass="selectTagMenu" value="#{adminScheduleHandler.startAmpm}" style="width:50px;"> <f:selectItems value="#{adminScheduleHandler.ampmItems}"/> </ice:selectOneMenu> </ice:panelGroup> <ice:outputLabel for="interval1" value="Interval:" /> <ice:panelGroup> <ice:selectOneMenu id="interval1" styleClass="selectTagMenu" value="#{adminScheduleHandler.interval}" style="width:120px;"> <f:selectItems value="#{adminScheduleHandler.intervalItems}"/> </ice:selectOneMenu> <ice:message for="interval1" /> </ice:panelGroup> </ice:panelGrid> <ice:panelGroup style="text-align: center; width:100%;"> <ice:commandButton actionListener="#{adminScheduleHandler.cancelEditor}" style="z-index:2;" value="Cancel" /> <ice:commandButton action="#{adminScheduleHandler.createEntries}" value="Create Entries" rendered="#{adminScheduleHandler.new} " style="z-index:2;"/> </ice:panelGroup> ...... public void scheduleClicked(ScheduleMouseEvent event) { switch (event.getEventType()) { case ScheduleMouseEvent.SCHEDULE_BODY_CLICKED: log.info("time=" + event.getClickedTime().toString()); startTime = event.getClickedTime(); Calendar calendar = GregorianCalendar.getInstance(); if (startTime == null) startTime = new Date(); calendar.setTime(startTime); startHour = calendar.get(Calendar.HOUR); startMin = calendar.get(Calendar.MINUTE); startAmpm = calendar.get(Calendar.AM_PM); isNew = true; showEditor = true; break; .... }
        Hide
        Mark Collette added a comment -

        Sheng Gu, I understand that your problem was not with selectInputDate, but it prompted me to test selectInputDate, to see how it would behave, and I found that it was an issue with it too.

        What you should do, is paste your comment above into ICE-1343, along with the body of your cancelEditor(ActionEvent) method. As well, I should warn you that your Calendar code does not handle TimeZones or Locales, which selectInputDate does.

        Show
        Mark Collette added a comment - Sheng Gu, I understand that your problem was not with selectInputDate, but it prompted me to test selectInputDate, to see how it would behave, and I found that it was an issue with it too. What you should do, is paste your comment above into ICE-1343 , along with the body of your cancelEditor(ActionEvent) method. As well, I should warn you that your Calendar code does not handle TimeZones or Locales, which selectInputDate does.
        Hide
        Sheng Gu added a comment -

        Hi Mark, I talked my issue with Philip, and he told me to use inputText.setSubmittedValue("") to clear inputText component.

        Our schedule component is from Myfaces Tomahawk 1.5, which didn't have TimeZones and Locales (1.7 have them). On our schedule page, left side is ice:selectInputDate as date calendar, and right side is myfaces schedule calendar.

        Show
        Sheng Gu added a comment - Hi Mark, I talked my issue with Philip, and he told me to use inputText.setSubmittedValue("") to clear inputText component. Our schedule component is from Myfaces Tomahawk 1.5, which didn't have TimeZones and Locales (1.7 have them). On our schedule page, left side is ice:selectInputDate as date calendar, and right side is myfaces schedule calendar.
        Hide
        Mark Collette added a comment -

        #1 Fixed.

        I also made it so that when you click on a date in the popup calendar, it will set the focus on the button you just clicked, and not the selectInputDate's input text field, since the input text field uses an onblur handler, so if you then click anywhere else it would have submitted the form again, redundantly.

        #2 This is just how JSF works. After getting rid of the needless update from the onblur, I realised that it's doing what it should.

        Trunk: Subversion 15150
        icefaces\component\src\com\icesoft\faces\component\selectinputdate\SelectInputDateRenderer.java

        ICEfaces 1.6.2 Branch: Subversion15151
        icefaces\component\src\com\icesoft\faces\component\selectinputdate\SelectInputDateRenderer.java

        Show
        Mark Collette added a comment - #1 Fixed. I also made it so that when you click on a date in the popup calendar, it will set the focus on the button you just clicked, and not the selectInputDate's input text field, since the input text field uses an onblur handler, so if you then click anywhere else it would have submitted the form again, redundantly. #2 This is just how JSF works. After getting rid of the needless update from the onblur, I realised that it's doing what it should. Trunk: Subversion 15150 icefaces\component\src\com\icesoft\faces\component\selectinputdate\SelectInputDateRenderer.java ICEfaces 1.6.2 Branch: Subversion15151 icefaces\component\src\com\icesoft\faces\component\selectinputdate\SelectInputDateRenderer.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Mark Collette
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: