//Alternative Solution: Don’t use select callback!
//***Solution works for both Static and Ajax Tabs.
-------------------------------------------------
//On each Ajax tab’s JSP, use following method:
$(document).ready(function() {
// Prevent accidental navigation away
$(':input',document.forms['<Tab1’sBeanName>']).bind("change",
function() { setchangeFlag("<fromTab1>"); });
});
//---------------fromTab2, 3 and so on-------------
//On index JSP use following 4 methods:-
function setchangeFlag(text)
{
document.forms[0].changeFlag.value =text;
}
function resetchangeFlag()
{
document.forms[0].changeFlag.value ="N";
}
function checkChangeFlag()
{
if(document.forms[0].changeFlag.value !="N")
{
var agree = confirm("Do you want to save your changes?");
if (agree)
{
if(document.forms[0].changeFlag.value==" fromTab1")
{
document.forms['<Tab1’sBeanName>'].action.value
= 'doUpdate';
document.forms['<Tab1’sBeanName>'].submit();
}
if(document.forms[0].changeFlag.value=="fromTab2")
{
document.forms['<Tab1’sBeanName>'].action.value
= 'doUpdate';
document.forms['<Tab1’sBeanName>'].submit();
}
resetchangeFlag() ;
return true ;
}
else
{
resetchangeFlag() ;
return false ;
}
}
}
$(document).ready(function(){
$('#ap > ul').tabs({ fx: { opacity: 'toggle' }, selected: $
{tabnum} });
});
//-----------------<div id="ap"> is my division containing Ajax
tabs-------------------------------
//in the controller I check the action value, if it is doUpdate, then
I write data to the DB.
//tabnum is set in each tab's controller to a value depending upon
//which Tab's Save button was clicked. So that user comes to the same
tab after saving data.
//Hope this will help someone...
//Best Regards to the jQuery developers! I love jQuery!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---