I need to change the status in database but when I change the status the confirmDialog is not taking the new value, it gets the old one
<p:selectOneMenu converter="omnifaces.SelectItemsConverter" disabled="#{myBB.currentStatus != StatusEnum.TEMP}"
id="statusSOM" onchange="PF('confirm').show();" value="#{myBB.currentStatus}" widgetVar="statusWV">
<f:selectItems itemDisabled="#{status == StatusEnum.ALL}" itemLabel="#{msgs[status.name]}"
itemValue="#{status}" value="#{myBB.statusList}" var="status" />
</p:selectOneMenu>
<p:confirmDialog widgetVar="confirm" message="Save?" header="Confirm" severity="alert">
<p:commandButton action="#{myBB.saveStatus}" oncomplete="PF('confirm').hide();"
update="form1 form2" value="Yes" />
<p:commandButton value="No" type="button"
onclick="PF('statusWV').selectValue(PF('statusWV').preShowValue.val());PF('confirm').hide();" />
</p:confirmDialog>
What can I do?
You need to update your
p:confirmDialog
component when the value is updated. That's straightfoward if you use the handyp:ajax
on yourp:selectOneMenu
.