3 Replies Latest reply on Apr 18, 2008 2:38 PM by braddm7

    manually adding to Collection for <s:selectitems

    braddm7

      Here is a Facelet part that is working fine:


      <h:selectOneMenu value="#{backingObj}">
         <s:selectItems value="#{backingObjList}" var="obj" label="#{obj.objCode}" noSelectionLabel="choose..." hideNoSelectionLabel="true" />                            <s:convertEntity />          
         <a:support event="onchange" immediate="false"   reRender="mainPanel" actionListener="#{bean.doSomething}"/>
      </h:selectOneMenu>



      The 'backingObjList' is obtained via JPA and is in persistence context. This is working perfectly well. What I did is the following in the Seam's action:


      backingObjList.add(0, someNewObjOfThisType);



      This someNewObjOfThisType is transient with only a few properties initialized. When I submit the form any of the other items are injected to backingObj just fine except for the new object which is only displayed fine in the SELECT. When submitted it is always NULL at the Seam's action. With an Http Sniffer i see that actually a valid-looking number is submitted to the server. For example 41,42, etc. On the front-end there is nothing suspicious.
      I am thinking that there might be something in the someNewObjOfThisType that is mandatory to be set like properties involved in someNewObjOfThisType's equals or hashCode methods or something else.
      Currently I am begging for help :-)