2 Replies Latest reply on May 5, 2011 1:45 PM by y.elpyaz

    noSelectionLabel issue with selectOneMenu

    salski22

      I have issue with noSelectionLabel. In my xhtml page I have


      <h:selectOneMenu 
             converter="#{reservation.converter}">
              <s:selectItems  value="#{reservation.locationListMap}" />         
       </h:selectOneMenu>



      I get


      <select size="1" name="doctorForm:j_id14">
         <option value="Gdańsk">Gdańsk</option>
         <option value="Kraków">Kraków</option>
         <option value="Lębork">Lębork</option>
         <option value="Poznań">Poznań</option>
         <option value="W-wa">W-wa</option>
         <option value="kkk">kkk</option>
         <option value="Łebień">Łebień</option>
      </select>
      


      and this is OK.
      The problem I have when I want to add noSelectionLabel


      <h:selectOneMenu 
             converter="#{reservation.converter}">
              <s:selectItems  value="#{reservation.locationListMap}" 
                     noSelectionLabel="Select ..." hideNoSelectionLabel="true" />        
       </h:selectOneMenu>



      i get only noSelectionLabel without other selection to choose


      <select size="1" name="doctorForm:j_id14">
         <option selected="selected" value="org.jboss.seam.ui.NoSelectionConverter.noSelectionValue">Select ...</option>
      </select>
      



      How can I add to the list label Select ... which will do nothing?

        • 1. Re: noSelectionLabel issue with selectOneMenu
          tausuahmed

          Hi,


          One option is to discard noSelectionLabel and add an item to list with select label and with some value.


          Regards,
          Tauseef

          • 2. Re: noSelectionLabel issue with selectOneMenu


            Hi
            
            I dont think this code works
             <s:selectItems  value="#{reservation.locationListMap}" 
                           noSelectionLabel="Select ..."  />  
            
            any way 
            
            U can use
            <h:selectOneMenu converter="#{reservation.converter}">
            
            
            <s:selectItems  value="#{reservation.locationListMap}" var="location" label="#{location.locationName}" 
            itemValue="#{location.LocationName}"
                           noSelectionLabel="Select ..." hideNoSelectionLabel="true" />  
            </h:selectOneMenu >
            
            
            if location is an instnce of a class
            
            use appropriate values for s:selectItems  attributes