0 Replies Latest reply on May 16, 2008 9:37 AM by amcghie

    Problem with verifying input after autocompletion via sugges

      Hi all,

      I have an issue when attempt to verify the value of an inputText control (zoneBand in the example below) when a suggestionbox has populated the value I get a verification error. The code is shown below:

      In my JSF page I have the following:

      <h:panelGroup>
       <h:inputText id="zoneBand"
       binding="#{zoneBandPrefixHandler.userZoneBand}"
       validator="#{zoneBandHandler.validateExistingZoneBand}"
       size="15"
       required="true"
       style="spacing: 4px; spacing: 4px" />
       <rich:suggestionbox id="zoneBandSuggestBox"
       for="zoneBand"
       var="zb"
       suggestionAction="#{zoneBandHandler.autocomplete}"
       fetchValue="#{zb.description}"
       border="1" width="250" height="150"
       nothingLabel="Zone Band not found">
       <h:column>
       <h:outputText value="#{zb.description}" />
       </h:column>
       <rich:column>
       <h:outputText value="#{StaticData.lobMap[zb.lob]}" />
       </rich:column>
       </rich:suggestionbox>
       <h:message for="zoneBand" style="color: #f00; vertial-align: top;" />
      </h:panelGroup>


      The validator in zoneBandHandler is as follows:

      class ZoneBandHandler {
       ...
       public void validateExistingZoneBand(FacesContext context, UIComponent component, Object value) {
      
       ZoneBand existingZoneBand = daoFactory.getZoneBandDAO().selectByZoneBand(value.toString());
       if (existingZoneBand == null)
       throw new ValidatorException(new FacesMessage("Zone Band: " + value.toString() + " does not exist."));
       }
       ..
      }


      If I type "In" and "International"is shown in the Suggestion Box, I then select this (so it appears in the zoneBand textbox and then submit the form, the following error appears in my log file:

      16-May-2008 12:57:48 com.sun.faces.lifecycle.RenderResponsePhase execute
      INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=zoneBandAllocationForm:zoneBand[severity=(INFO 0), summary=(Zone Band: In does not exist.), detail=(Zone Band: In does not exist.)]


      Has anyone seen this before and do you know how to stop it happening?

      Many Thanks

      Andy