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>
<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"/>
remove ajaxSingle="true". Only command button processed in this case. or add process="selectId" if you need this ajax single.