3 Replies Latest reply on Jul 6, 2007 12:11 PM by grettke_spdr

    Why doesn't this h:message work for the h:selectOneMenu?

    grettke_spdr

      Hi folks,

      I've got a page with a selectOneMenu on it. The validation h:message just displays the message right next to it. This approach works for all of the text fields correctly, but for some reason it doesn't work with this selectOneMenu.

      Instead the message gets displayed in the area of the page normally reserved for top level messages.

      rms:enumListConverter is an enum converter.

      <h:outputLabel for="selectedPriority" value="Priority:"/>
      <h:selectOneMenu
       id="selectedPriority"
       value="#{inspectionSearchForm.selectedPriority}"
       required="false"
       disabled="false">
       <s:selectItems
       value="#{inspectionSearchForm.priorities}"
       var="priorityEnum"
       label="#{priorityEnum.description}"/>
       <rms:enumListConverter/>
      </h:selectOneMenu>
      <h:message for="selectedPriority" styleClass="error" />
      




        • 1. Re: Why doesn't this h:message work for the h:selectOneMenu?
          pmuir

          Whats the message (aka where is it originating)

          • 2. Re: Why doesn't this h:message work for the h:selectOneMenu?
            grettke_spdr

             

            "pete.muir@jboss.org" wrote:
            Whats the message (aka where is it originating)


            Hi Pete,

            I was looking at one approach to doing custom validations, and testing out how the error messages show up. The approach in this system is the "form" and "action" style. I added messages in the action. Here is how it looks:

            @Name("inspectionSearchAction")
            @Scope(ScopeType.SESSION)
            public class InspectionSearchActionImpl implements InspectionSearchAction {
            
             @Logger
             Log log;
            
             @In
             FacesMessages facesMessages;
            
             public void search() {
             try {
             facesMessages.addToControl("territoryNumber","territoryNumber");
             facesMessages.addToControl("riskControlRepNumber","riskControlRepNumber");
             facesMessages.addToControl("accountNumber","accountNumber");
             facesMessages.addToControl("selectedPriority","selectedPriority");
             facesMessages.addToControl("companyName","companyName");
             facesMessages.addToControl("selectedState","selectedState");
             facesMessages.addToControl("city","city");
             facesMessages.addToControl("county","county");
             facesMessages.addToControl("zipCode","zipCode");
             facesMessages.addToControl("surveyRangeStart","surveyRangeStart");
             facesMessages.addToControl("surveyRangeEnd","surveyRangeEnd");
             facesMessages.addToControl("inspectionCompleteRangeStart","inspectionCompleteRangeStart");
             facesMessages.addToControl("inspectionCompleteRangeEnd","inspectionCompleteRangeEnd");
             } catch (Exception e) {
             log.error(e);
             }
             }
            }
            


            • 3. Re: Why doesn't this h:message work for the h:selectOneMenu?
              grettke_spdr

              I could not reproduce this!