ICEfaces
  1. ICEfaces
  2. ICE-1343

An <ice:commandButton> with immediate="true" does not set the UIInput.setSubmittedValue(null) like the ProcessValidations phase does

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.5.3
    • Fix Version/s: None
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Windows XP / Tomcat 5.5.17
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      The workaround is a hack. It involves putting an action listener on the Cancel button:

                <ice:commandButton actionListener="#{PortalUserList.rowPanelGroupCancelButtonListener}" immediate="true" styleClass="portlet-form-button" value="#{DataTableMsgs.keyValues['Cancel']}"/>

      Here is the listener:

          public void rowPanelGroupCancelButtonListener(ActionEvent actionEvent)
          {
              this.rowPanelGroupVisible = false;
              JSFUtils.clearSubmittedFormValues(JSFUtils.getForm(actionEvent.getComponent()));
          }

      And here is the clearSubmittedFormValues() static methods from my JSFUtils class:

          /**
           * This method (along with its private, recursive counterpart) is more or less a hack to try and fix a problem that
           * manifests itself with ICEfaces and <ice:commandButton> components with immediate="true". The folks at ICEsoft
           * need to make this be part of their partial-submit aspect of the JSF lifecycle.
           */
          public static void clearSubmittedFormValues(UIForm uiForm)
          {
              clearSubittedFormValuesRecurse(uiForm);
          }


          private static void clearSubittedFormValuesRecurse(UIComponent uiComponent)
          {
              if (uiComponent instanceof UIInput)
              {
                  UIInput uiInput = (UIInput) uiComponent;
                  uiInput.setSubmittedValue(null);
              }
              List childList = uiComponent.getChildren();
              if (childList != null)
              {
                  Iterator iterator = childList.iterator();
                  while (iterator.hasNext())
                  {
                      clearSubittedFormValuesRecurse((UIComponent) iterator.next());
                  }
              }
          }
      Show
      The workaround is a hack. It involves putting an action listener on the Cancel button:           <ice:commandButton actionListener="#{PortalUserList.rowPanelGroupCancelButtonListener}" immediate="true" styleClass="portlet-form-button" value="#{DataTableMsgs.keyValues['Cancel']}"/> Here is the listener:     public void rowPanelGroupCancelButtonListener(ActionEvent actionEvent)     {         this.rowPanelGroupVisible = false;         JSFUtils.clearSubmittedFormValues(JSFUtils.getForm(actionEvent.getComponent()));     } And here is the clearSubmittedFormValues() static methods from my JSFUtils class:     /**      * This method (along with its private, recursive counterpart) is more or less a hack to try and fix a problem that      * manifests itself with ICEfaces and <ice:commandButton> components with immediate="true". The folks at ICEsoft      * need to make this be part of their partial-submit aspect of the JSF lifecycle.      */     public static void clearSubmittedFormValues(UIForm uiForm)     {         clearSubittedFormValuesRecurse(uiForm);     }     private static void clearSubittedFormValuesRecurse(UIComponent uiComponent)     {         if (uiComponent instanceof UIInput)         {             UIInput uiInput = (UIInput) uiComponent;             uiInput.setSubmittedValue(null);         }         List childList = uiComponent.getChildren();         if (childList != null)         {             Iterator iterator = childList.iterator();             while (iterator.hasNext())             {                 clearSubittedFormValuesRecurse((UIComponent) iterator.next());             }         }     }

      Description

      An <ice:commandButton> with immediate="true" does not set the UIInput.setSubmittedValue(null) like the ProcessValidations phase does. This causes problems when you have two panelgroups (only one rendered at a time) with <ice:panelGroup rendered="#{Bean.isRendered}"> and <ice:panelGroup rendered="#{!Bean.isRendered}"> like we have in PortalUserList.jspx.

        Issue Links

          Activity

          There are no subversion log entries for this issue yet.

            People

            • Assignee:
              Unassigned
              Reporter:
              Neil Griffin
            • Votes:
              10 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: