1 Reply Latest reply on Oct 13, 2008 10:29 AM by ilya_shaikovsky

    Help With Achieving Functionality Like PickList

    leesy

      Hi,

      I'm sure this question has been asked hundreds of times before but I couldn't think of what to search for to find similar questions. I'm also asking it here and not the seam forum as I'm using mainly the Ajax4J components.

      I've got a form that I am using to persist of an object. Lots of inputs to type text into and a submit button. On the form I also want a dropdown with a list of items, an add button and then another box showing what has been selected. So basically something like the picklist component but with a simple dropdown instead.

      Trouble is I can't seem to get it right when using a dropdown and command button. If I have a dropdown with an onchange all works:

      <h:selectOneMenu id="reportAvailablePresences" value="#{reportHome.presenceHolder}" immediate="true">
       <s:selectItems var="currItem" value="#{listAvailablePresences}" label="#{currItem.displayName}" noSelectionLabel="Select a presence..."/>
       <s:convertEntity/>
       <a4j:support event="onchange" action="#{reportHome.addSelectedPresence()}" reRender="presences" ajaxSingle="true"/>
      </h:selectOneMenu>


      For the command button I've been trying something like this (which doesn't work):
      <h:selectOneMenu id="reportAvailablePresences" value="#{reportHome.presenceHolder}" immediate="true">
       <s:selectItems var="currItem" value="#{listAvailablePresences}" label="#{currItem.displayName}" noSelectionLabel="Select a presence..."/>
       <s:convertEntity/>
      </h:selectOneMenu>
      <a4j:commandButton action="#{reportHome.addSelectedPresence()}" reRender="presences" ajaxSingle="true" value="Add"/>


      Can anyone point me in the way of the correct solution?

      Cheers,
      Lee