1 Reply Latest reply on Sep 17, 2008 11:23 AM by saipanman95

    rich:modalPanel disables selectOneMenu after error messages

    saipanman95

      Hello All,

      I have been working this for a while now and not really sure how to get
      around it. I have a SelectOneMenu populated with selectItems inside a
      form. The required attribute is set to true and the requiredMessage
      attribute is set to "Please select a position". The form elements (including
      the selectOneMenu) is nested inside a rich:modalPanel.

      Without the modalPanel this problem doesn't occur, so I thought I would
      ask you all for suggestions.

      What happens is that since the selectOneMenu is required the messages
      fire--the expected behavior BUT the selectOneMenu for some reason also
      disables itself. Now, I am thinking that this "disabled" quality of the
      selectOneMenu has something to do with the component loosing it value
      and/or selectItems values--not sure though. The applicable code is listed
      below:

      <rich:modalPanel id="groupsAddPanel"
       width="500" height="450"
       style="background-color: #EEEECB;"
       binding="# {membersHandler.addNewMembers}">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText id="groupsAddPanelHeaderText"
       value="#{membersHandler.addMembersHeaderLabel}"/>
       </h:panelGroup>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:graphicImage value="/images/close.png"
       style="cursor:pointer"
       id="hidelinkAddGroups"/>
       <rich:componentControl for="groupsAddPanel"
       attachTo="hidelinkAddGroups"
       operation="hide" event="onclick"/>
       </h:panelGroup>
       </f:facet>
       <a4j:region id="groupsAddRegion">
       <a4j:form id="groupsAddForm" ajaxSubmit="true"
       rendered="true" status="groupAddStatusId" >
       <h:panelGroup id="groupsAddPanelGroup"
       rendered="true" >
       <table cellpadding="3" cellspacing="0" border="0"
       id="addGroupsTable"
       style="background-color: #EEEECB;" >
      
       ....
      
       <tr>
       <td class="groupsTdLables">
       <h:outputText id="posLblGroupsAddForm"
       value="Position: "/>
       </td>
       <td colspan="3" class="addGroupsInputs">
       <h:selectOneMenu id="positionDropDown"
       valueChangeListener="#{membersHandler.positionSelected}"
       required="true"
       requiredMessage=" Please select a position!"
       value="#{membersHandler.dirtyMembers.srpMemLuId}"
       binding="#{membersHandler.membPosHtmlSelectOneMenu}">
       <f:selectItems
       value="#{membersHandler.generalSelectItem}"
       binding="#{membersHandler.membPosSelectItems}"/>
       <a4j:support event="onchange"
       reRender="positionDropDown"/>
       </h:selectOneMenu>
       </td>
       </tr>
      
       ......
      
       </table>
      
       <h:panelGrid id="groupsAddPanelButtonsPanelGrid"
       columns="3" style="text-align:center; width:100%;">
       <a4j:commandButton
       id="saveLinkAddGroupsPanel"
       value="#{srpBundle.hlinkSave}"
       styleClass="buttons01"
       tatus="groupAddStatusId"
       rendered="true"
       action="#{membersHandler.saveNewRow}"
       onclick="this.value='Processing...';
       this.disabled=true;"
       oncomplete="windowclose();">
       <a4j:support event="onclick"
       reRender="addGroupsTable"/>
       </a4j:commandButton>
       <rich:spacer id="blankspaceId" width="200px;" />
       <a4j:commandButton
       id="cancelLinkAddGroupsPanel"
       value="#{srpBundle.hlinkCancel}"
       styleClass="buttons01"
       status="groupAddStatusId"
       rendered="true"
       reRender="facStudRotcForm"
       immediate="true">
       <rich:componentControl
       id="richCmptCntrlCancelAddGroupsPanel"
       for="groupsAddPanel"
       attachTo="cancelLinkAddGroupsPanel" operation="hide" event="onclick"/>
       </a4j:commandButton>
       </h:panelGrid>
       </h:panelGroup>
      
       </a4j:form>
       <a4j:status id="groupAddStatusId"
       startText="One Moment Please..."
       stopText="Ready!"
       style="text-align: center; font-size: 14px; font-weight: bold;"/>
       </a4j:region>
       <rich:messages id="richMessagesBaseForm2"
       binding="#{membersHandler.htmlRichMessages}"
       style="text-align: left"
       passedLabel="Data is allowed to be stored."
       layout="list">
       <f:facet id="richMessagesBaseFormFacetHeader"
       name="header">
       <h:outputText id="baseFormOutPutText"
       value="Entered Data Status:">
       </h:outputText>
       </f:facet>
       <f:facet id="richMessagesBaseFormFacetPassed"
       name="passedMarker">
       <h:graphicImage id="baseFormImagePassed"
       value="/images/passed.gif"/>
       </f:facet>
       <f:facet id="richMessagesBaseFormFacetError"
       name="errorMarker">
       <h:graphicImage id="baseFormImageError"
       value="/images/error.gif"/>
       </f:facet>
       </rich:messages>
      </rich:modalPanel>
      


      I didn't see a need to post the valueChangeListern method because
      according to my debugger I never get there. The require=true attribute
      doesn't let the valueChangeListerner fire.

      Any ideas?