I want to update a selectOneMenu in form1 after submitting the commandbutton in form2. It is now only visible after a refresh of the page.
I have a selectOneMenu in form 1:
<h:form id="form1" rendered="#">
<p:spacer height="30" />
<h:selectOneMenu id="oneMenu" value="#{bean.value}">
<f:selectItem itemLabel="Select Value" itemValue="" />
<f:selectItems id="itemValues"
value="#{bean.allItems}" var="allItems"
itemValue="#{allItems}" itemLabel="#{allItems.name}" />
</h:selectOneMenu>
and a DialogBOX in form2:
<h:form id="form2">
<p:dialog header="Create new Item" widgetVar="newItem"
resizable="false">
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="item" value="Itemname:" />
<p:inputText id="itemname" value="#{bean.itemName}" />
</h:panelGrid>
<p:commandButton value="Submit"
actionListener="#{bean.newItem}"
update="form1:oneMenu" oncomplete="newItem.hide();" />
</p:dialog>
I've tried update="form1:oneMenu"
but it doesn't work. I've also read this post
but it doesn't work either.
Thanks for help.