Cancel Jquery Accordion close if condition is not met

I have an accordion that on load gets data using ajax to fill it starts getting autoupdates. Then on close I unload the data and removes it from autoupdate list.

But the user can open an Edit page in the accordion, and if this page is open the user should get a warning if he tries to close the accordion e.g. (Closing this will cause you to loose all none saved data) or similar.

So I want to "intercept" the accordion toggle close event and if certain data (The edit page) is loaded inside the accordion a "are you sure" warning should popup.

Answers


$( ".selector" ).accordion({
   changestart: function(event, ui) { 
     ...
     if (dataInvalid) {
       return false;
     }
   }
});

Need Your Help

XML Parsing + Any way to write TestCase for XML Parsing

xml ruby-on-rails-3 rake xml-parsing rake-task

Can any one suggest, How to write test case for XML value.. when it is parsed in Rake Task ?

Relationships on attribute level in Enterprise Architect

attributes uml modeling class-diagram enterprise-architect

I am looking for the best solution to draw mapping diagram in EA. I find that composite structure diagram might suits my needs. I have even found good example of such diagram on the net:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.