1 Reply Latest reply on Oct 9, 2008 9:20 PM by Ken Stoneman

    Problem with selection in SelectOneList

    Espen Simensen Newbie


      I am using Seam 1.2.1 and I am having trouble with a selectOneMenu component. I initialize the list with a List of Roles. This works fine. But when I press the store button, null is always sent to the database. Also when I edit a user, the correct Role is NOT selected in the list.

      <h:selectOneMenu id="role" value="#{user.role}" required="true">
      <s:selectItems value="#{roles}" var="role" label="#{role.name}" noSelectionLabel="Please select..." />

      If I remove the noSelectionLabel I get an exception because of a missing Converter. I've tried to add a converter with s:converter. This helps with the exception, but not with the initial problem.

      Help would be very appreciated.

        • 1. Re: Problem with selection in SelectOneList
          Ken Stoneman Newbie
          You are a step ahead of me, maybe you can help.

          I am trying to return a list of Roles as well to a drop down.  Here is what I have in the xhtml:

          <h:selectOneMenu id="rolename" styleClass="text" value="#{rbacRolesList.rbacRoles.rolename}">      
          <s:selectItems value="#{roleNameList.resultList}" var="roleName" label="#{roleName.description}" noSelectionLabel="None"/>                                                                                                                                                                                                                                                 

          What I dont understand is what I need to do to the code...as in the java file and the class file to make this work.

          It just appears on the page with the "None" in it?

          Any help would be great.