One page contains the rich face tab panel and having 4 tabs. In one of the tab, I have text box and save button . Without saving the data If i move to another tab, It should show the popup saying unsaved data and prevent the navigation.
I tried calling a popup using different java script loading attributes of rich:tabPanel but not serving the purpose.
Here is the code
<rich:tabPanel onclick="#{rich:component('confirmation')}.show();return false" switchType="ajax" id="wizardTab" itemChangeListener="#{bean.tabChange}" activeItem="#{bean.activeTab}">
<rich:tab id="tab1"
// tab1
</rich:tab>
<rich:tab id="tab2"
</rich:tab>
<rich:tab id="tab3"
</rich:tab>
<rich:tab id="tab4"
<h:inputText id="test"
styleClass="span2" maxlength="25"
value="#{bean.rowForChange.code}">
<f:ajax event="blur" execute="@this"/>
</h:inputText>
<h:commandButton value="Update" styleClass="button"
style="width:160px"
action="#{bean.updtae}">
<a4j:ajax execute="paramValue"
render="table simeditPnl" />
</h:commandButton>
</rich:tab>
</rich:tabPanel>
<rich:popupPanel render="#{jCRDataRefreshManagement.updateStatus}" id="confirmation" modal="false" autosized="true" resizeable="false">
<f:facet name="header">Confirmation</f:facet>
<h:panelGrid>
<h:panelGrid columns="2">
<h:graphicImage value="/alert.png" />
<h:outputText value="You have unsaved changes. Are you sure?" style="FONT-SIZE: large;" />
</h:panelGrid>
<h:panelGroup>
<input type="button" value="OK"
onclick="#{rich:component('confirmation')}.hide();submit();return false" />
<input type="button" value="Cancel"
onclick="#{rich:component('confirmation')}.hide();return false" />
</h:panelGroup>
</h:panelGrid>
</rich:popupPanel>
If any unsaved data on the text box on tab 4 and tried to click on any other tab it should stay in the tab 4 and show the confirmation poupup as above.
With this implementation my popup is opening whenever I am clicking the tab.
Please point out the mistake I am doing or give the suggestion for above scenario. Any help appretiated