View Full Version : TabPanel - Prevent closing tab with a dirty form

22 Jun 2010, 2:44 AM

I've got several tabs containing each a form and I would like to prevent users from changing tab without having saved their changes (ie if the form of the current tab is dirty).
My problem is that I dynamically load the tabs and I don't manage to reach the generated forms from my main page.
Here is my main page code :

function handleActivate(panel)
url: 'data/account/'+panel.id+'.jsp',
params: {account: activeAccount},
discardUrl: false,
nocache: false,
text: 'Loading...',
scripts: true

var accountTabs = new Ext.TabPanel({
region: 'center',
id: 'account-description',
activeTab: 'information',
plain: true,
border: true,
enableTabScroll: true,
autoScroll: true,
autoScroll: true,
closable: false
layoutOnTabChange: true,
style: 'background-color: white',
id: 'information',
html: ' ',
title: 'Informations',
listeners: {activate: handleActivate}
}, {
id: 'documents',
html: ' ',
title: 'Documents',
listeners: {activate: handleActivate}
}, ...]
The var activeAccount is dynamically set after the page has been load and can be modified by the user.

The loaded contents are forms rendering in div with unique id.

I've spend several hours trying several methods, listeners ... and I didn't manage to get anything.

Thank you for your help