I feel like I am close, but the problem is that my dialog "confirmNavigation" shows up for a second, then is closed by the navigation to the new tab, because it doesn't block. So I was hoping to cancel the event then do the naivgation from the dialog, is this possible?
Here is what I have:
Code: Select all
<p:tabView onTabShow="bindForChange();" onTabChange="handleTabChange(event, ui);" effect="height" cache="false" collapsible="true" dynamic="true" >
Code: Select all
<script type="text/javascript">
dataChanged = 0;
function bindForChange()
{
jQuery('input,checkbox,textarea,radio,select').bind('change',function(event) {dataChanged = 1});
jQuery(':reset,:submit').bind('click',function(event) { dataChanged = 0 });
}
function fireDataChanged()
{
dataChanged = 1;
}
function handleTabChange(event, ui)
{
if ( dataChanged )
{
confirmNavigation.show();
//abort and let my dialog above handle things from here!!!
return false;
}
}
</script>
Thanks