2 Replies Latest reply on Feb 23, 2007 12:38 PM by Luis Mendes

    How convertEntity works with the noSelectionLabel

    Luis Mendes Newbie

      Hi,

      I'm using the Seam convert convertEntity code to fill a sectOneMenu,

      <h:selectOneMenu id="tipoNivel"
       value="#{descricaoNivelList.descricaoNivel.descricaoTipoNivel}">
       <s:selectItems value="#{descricaoTipoNivelList.resultList}"
       var="descricaoTipoNivel"
       label="#{descricaoTipoNivel.descricao}"
       required="false"
       noSelectionLabel="Any"/>
       <ec:convertEntity />
      </h:selectOneMenu>
      


      My question is, Can the convertEntity detect that the noSelectionLabel was select by the user? (Helpful to detect if the user whats to use the field in a search criteria )

      best regards,
      Luis Mendes





        • 1. Re: How convertEntity works with the noSelectionLabel
          Pete Muir Master

          There were some problems with s:selectItems in 1.1.6 (fixed in CVS) which meant that noSelectionLabel didn't work quite right.

          So, in CVS, if the noSelectionLabel is selected a value of null will be passed to the entity converter, which passes this straight through to the backing bean. I know this doesn't really answer the question, but hopefully you can work out what you want to know from here.

          Btw this is an idea for a "Any" option, alternatively you could just write a custom converter from scratch...

          <h:selectOneMenu id="tipoNivel" value="#{descricaoNivelList.descricaoNivel.descricaoTipoNivel}" converter="foo.converter">
           <f:selectItem itemLabel="Any" itemValue="any" />
           <s:selectItems value="#{descricaoTipoNivelList.resultList}"
           var="descricaoTipoNivel"
           label="#{descricaoTipoNivel.descricao}"/>
           <ec:convertEntity />
          </h:selectOneMenu>


          Where you would need to write the foo.converter (make it extend EntityConverter, do something with any, then delegate to EntityConverter)

          • 2. Re: How convertEntity works with the noSelectionLabel
            Luis Mendes Newbie

            Thanks a lot for the reply. I have followed the solution to change the entity converter (returning null) because it can be applied more easily to other pages.