2 Replies Latest reply on Nov 7, 2005 9:26 PM by Doug Schnelzer

    Are explicit id attributes required on JSF components?

    Daniel Miklancic Newbie

      The following code does not render properly following a validation error. However, if one adds the id attribute to the panelGrid component, it works fine.

      <f:view>
       <h:form id="buildTagForm">
       <h:panelGrid columns="1">
       <h:outputText id="datamsg" value="Enter data" styleClass="portlet-form-label" />
       <h:selectOneRadio id="typeSelectOneRadio" value="4"
       title="Select the element-00" rendered="true" required="true">
       <f:selectItem itemValue="0" itemLabel="0" />
       <f:selectItem itemValue="1" itemLabel="1" />
       <f:selectItem itemValue="2" itemLabel="2" />
       </h:selectOneRadio>
       <h:message id="radioMsg" for="typeSelectOneRadio" showDetail="true"
       fatalClass="portlet-msg-error" errorClass="portlet-msg-error"
       warnClass="portlet-msg-alert" infoClass="portlet-msg-success" />
       <h:commandButton id="nextBtn" action="next" value="Next"
       rendered="true" styleClass="portlet-form-button" />
       <h:commandButton id="cancelBtn" action="cancel" immediate="true"
       value="Cancel" styleClass="portlet-form-button" />
       </h:panelGrid>
       </h:form>
      </f:view>
      
      


      I have experienced simlar rendering problems with command buttons in panel groups when rendering following a validation error. Again, adding an id="somePanelGroup" attribute fixes the problem.

      Does JBoss portal require an explicit id attribute for each and every element in a JSF component tree? If so, can someone explain why this is required? Why does the rendering problem only arise following a validation error? (In the above example, submit the form without selecting one of the radio buttons. The page redisplays without its buttons. In some cases, the radio buttons do not appear either upon redisplay. Strangely, if not validation error occur, everthing works as one would expect).

      JBPortal 2.0.1RC3/JB 4.0.3SP1