I would like to show different dialog from a single button depends on backingbean calculation. Like show a msg "Bill no has been paid already", if client enter a duplicate bill no, if the bill no is ok than shows like "Bill has been paid successfully". How can I achieve this?
backingbean class:
private String oncomplete="";
public String getOncomplete() {
return oncomplete;
}
public void setOncomplete(String oncomplete) {
this.oncomplete = oncomplete;
}
public void bill_fees_calculation(){
if(bill_no=="wrong"){
oncomplete = "PF('wrongDialog').show()";
}
else{
oncomplete = "PF('rightDialog').show()";
}
}
In my xhtml:
<p:commandButton oncomplete="#{backingbean.bill_fees_calculation}" icon="ui-icon-search" title="View" update=""/>
<p:dialog header="Bill Info" widgetVar="wrongDialog" modal="false" showEffect="fade" hideEffect="explode" resizable="false" closable="true" closeOnEscape="true">
<p:outputPanel id="billDetail" autoUpdate="true" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputText value="Output:" />
<h:outputText value="Bill no has been paid already" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
<p:dialog header="Bill Info" widgetVar="rightDialog" modal="false" showEffect="fade" hideEffect="explode" resizable="false" closable="true" closeOnEscape="true">
<p:outputPanel id="billDetail" autoUpdate="true" style="text-align:center;">
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputText value="Output:" />
<h:outputText value="Bill no has been paid successfully" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>