1 Reply Latest reply on Apr 7, 2008 5:29 AM by Ilya Shaikovsky

    rich:suggestionBox Richfaces 3.2.0.GA

    carlos inigo Newbie

      Hello,
      I have encountered an error in suggestionBox component.
      It doesn't work with especial characters like acents, '&' ,...
      I have a register in my database, in table Entites, with this name: 'Aragón Tercer Bilen'.

      I found the register using the suggestionBox component when I press in the h:inputTex this: 'Aragón terce'. Then I press search button and suggestion converts the value to Aragón Tercer Bilen, and for this reason the query doesn't find it in the database.

      Xhtml code:

      <s:decorate id="deco1" template="layout/display.xhtml">
       <ui:define name="label">#{messages['Entidad']}</ui:define>
       <h:inputText value="#{entidadList.nombreEntidad}" id="entidad" />
       <rich:suggestionbox for="entidad"
       suggestionAction="#{entidadList.autocomplete}" var="entidad" height="100"
       fetchValue="#{entidad}" tokens="," selfRendered="true" width="300">
       <h:column>
       <h:outputText value="#{entidad}" />
       </h:column>
       </rich:suggestionbox>
       </s:decorate>
      


      Java code:
      
       private String nombreEntidad="";
      
       public String getNombreEntidad() {
       return this.nombreEntidad;
       }
      
       public void setNombreEntidad(String nombreEntidad) {
       this.nombreEntidad=nombreEntidad;
       }
      
      
      public List autocomplete(Object event) {
       String pref = event.toString();
       System.out.println("Pref*********** : "+pref);
       Query query = getEntityManager()
       .createQuery("select entidad.nombre from Entidad entidad where entidad.nombre like :nombreEntidad order by entidad.nombre");
       query.setParameter("nombreEntidad", pref+"%");
       List<String> entidades =query.getResultList();
       return entidades;
       }
      


      Can you help me? Anyone with the same problem??

      Thanks,