1 Reply Latest reply on Sep 1, 2009 5:54 PM by oneworld95

    Incorrect values in dropdown box items

    oneworld95

      I've got the following code in my Seam page:


      <h:selectOneMenu >
        <f:selectItem itemLabel="" itemValue="#{null}"/>
        <s:selectItems var="tape" value="#{vldtapeformatList.resultList}" label="#{tape.description}" />
        <s:convertEntity/>
      </h:selectOneMenu>



      It generates this:


      <select name="vldtapeformatSearch:j_id14" size="1">     
              <option></option>
           <option value="0">VHS</option>
           <option value="1">DVD</option>
           <option value="2">Beta-SP</option>
           <option value="3">Digi-Beta</option>
           <option value="4">HD-Cam</option>
           <option value="5">DV-Cam</option>
           <option value="6">Mini-DV</option>
           <option value="7">DVC-PRO HD</option>
      </select>



      The @Id value is actually the same as the label, but it's given a numeric value. How do I display the actual, string @Id here and not the auto-generated number Seam has chosen? Thanks.

        • 1. Re: Incorrect values in dropdown box items
          oneworld95

          Never mind. Found it: It's the itemValue property, which Eclipse was simply not showing as an attribute of the s:selectItems tag. Not sure why. Here's the working code:


          <h:selectOneMenu >
            <f:selectItem itemLabel="" itemValue="#{null}"/>
            <s:selectItems var="tape" itemValue="#{tape.description}" value="#{vldtapeformatList.resultList}" label="#{tape.description}" />
            <s:convertEntity/>
          </h:selectOneMenu>