5 Replies Latest reply on Oct 2, 2008 3:15 AM by Ingo Jobling

    Validation: What Am I Missing

    Lee Theobald Newbie

      Hi all,

      I'm just trying to get my validation working on my page but I'm not having much luck.  I must be missing something simple so could someone have a quick look at my code below and see if you notice anything out of place.


      The error message is created using:

                    "A customer with an external ID of {0} already exists.  Please choose another",

      My page - a modal dialog included via a4j:include. (I've tested the code out of the modal dialog though and still no luck):

      <h:form id="modalForm">
            <h:messages globalOnly="true" />
            <f:facet name="aroundInvalidField">
              <s:span styleClass="errors" />
            <f:facet name="afterInvalidField">
              <s:div styleClass="errors">
                <s:message />
            <ul class="layout form">
                <label for="customerName">Name:</label>
                  <h:inputText id="customerName" value="#{customerHome.instance.externalId}" />
                  <label for="customerDisplayName">Display Name:</label>
                    <h:inputText id="customerDisplayName" value="#{customerHome.instance.displayName}" />
                  <label for="customerAccountManager">Account Manager</label>
                  <h:selectOneListbox id="customerAccountManager" value="#{customerHome.instance.accountManager}">
                    <s:selectItems var="item" value="#{accountManagersList}" label="#{item.displayName}" hideNoSelectionLabel="true"/>
                    <s:convertEntity /> 
                  <label for="customerDemo">Demo Customer?</label>
                  <h:selectBooleanCheckbox id="customerDemo" value="#{customerHome.instance.demo}" />
                  <a4j:commandButton value="Add New Customer" action="#{customerHome.persist}" reRender="resultsTable"/>

      I'm just constantly getting the error

      INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=modalForm:j_id103:customerName[severity=(ERROR 2), summary=(A customer with an external ID of abc already exists.  Please choose another), detail=(A customer with an external ID of abc already exists.  Please choose another)]

      The form input described in that error does exist, it just can't seem to link the message to it.  So - any suggestions?