3 Replies Latest reply on Nov 24, 2014 10:33 AM by michpetrov

    Problem with the new version of RichFaces 5.0 and rich:select empty.

    ignacio.ayuste

      Hi guys im using rich faces from the 4.0 version right now i updated for 4.5 version and i have problem when the rich:select have empty collection and make and ajax call is give me a javascript error. i attached the screenshot. aparrently is checking the length and is undefined because the collection is empty, this doesnt happen in early version. i remove the ajax call only for try and the problem is the same, i copy the code:

       

      Error Rich Select.png

       

      <h:outputLabel value="#{msgs['servicio.abm.label.cliente']}" for="cmbCliente"/>
      <rich:select id="cmbCliente" value="#{servicioController.cliente}" enableManualInput="true" clientFilterFunction="customFilter" defaultLabel="#{msgs['servicio.abm.combo.cliente.label']}" listWidth="575" styleClass="combo" converter="omnifaces.SelectItemsIndexConverter" >
      <f:selectItems itemLabel="#{c.apellido ne null ? (c.apellido.concat(' ')) : null}#{c.nombre} (#{c.id})" var="c" value="#{servicioController.clientes}" itemValue="#{c}"  />
      <a4j:ajax event="selectitem" listener="#{servicioController.cargarTitularesPorClienteAlta()}" render="panelComponentes"/>
      </rich:select>

       

       

      Thanks

      Ignacio

        • 1. Re: Problem with the new version of RichFaces 5.0 and rich:select empty.
          michpetrov

          Hi,

           

          I'm not sure what is happening there, if you have a select that's empty, you won't fire a "selectitem" event on it. And if you know the select is empty you can make it not render in the first place.

          • 2. Re: Problem with the new version of RichFaces 5.0 and rich:select empty.
            ignacio.ayuste

            Forgot the


            <a4j:ajax event="selectitem" listener="#{servicioController.cargarTitularesPorClienteAlta()}" render="panelComponentes"/>

             

            the problem still persist, it's right i can validate the content to avoid that behaviour but i think that isnt the idea, in this particular page i start the form with one combobox and if i dont render anything probably be confusing for the user, and also i need to review all the combobox to ensure this, probably is reinventing the wheel, the framework need to make that validation for me and if the combobox is empty simple do nothing.

             

            Thanks

            Ignacio

            • 3. Re: Problem with the new version of RichFaces 5.0 and rich:select empty.
              michpetrov

              As far as I can see the error will only be triggered if you try to open the dropdown, or is it being triggered by something else? In any case you should inform the user that the list is empty, if I saw an empty select I'd assume something is broken. So if the list is empty you can not render it and display a warning, or you can disable the component so user won't try opening it.