PDA

View Full Version : Javascript error : okBtn.btnEl is undefined



sharadtitan2006
25 Apr 2012, 7:04 AM
I am using ExtJS 3.0.0 and "Mozilla firefox - 3.6.28" and I am getting the following javascript error: okBtn.btnEl is undefined , when clicking on "OK" button of the MessageBox of ExtJS.
OR
yesBtn.btnEl is undefined when clicking on "YES" button of the MessageBox of ExtJS.
Note: In Interent Explorer it is working fine.

I pasting the Code that I am using below:
-----------------------------------------------------------------------
MsgBox: {
width: 300,
error: function(extraParam) {
var baseParams = {
title: extraParam.title ? extraParam.title : 'Error',
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
};
Ext.apply(baseParams, extraParam);
Ext.MessageBox.show(baseParams);
return false;
},
warn: function(extraParam) {
var baseParams = {
title: 'Warn',
icon: Ext.MessageBox.WARNING,
cls:'cl-alert-warn',
buttons: {ok: "OK"}
};

Ext.apply(baseParams, extraParam);
var dlg = Ext.MessageBox.getDialog();
Ext.QuickTips.register({
target: dlg.tools.close,
text: 'Close'
});
var okBtn = dlg.fbar.find(top.Ext.MessageBox.buttonText.ok)[0];
Ext.QuickTips.register({
target: [okBtn.btnEl, okBtn.btnEl.parent('.x-btn-mc')],
text: 'OK'
});

Ext.QuickTips.register({
target: dlg.body.child('.ext-mb-icon'),
text: 'Close'
});

Ext.MessageBox.show(baseParams);
},
info: function(extraParam) {
var baseParams = {
title: 'Info',
icon: Ext.MessageBox.INFO,
buttons: {ok: 'OK'}
};

Ext.apply(baseParams, extraParam);
var dlg = Ext.MessageBox.getDialog();
Ext.QuickTips.register({
target: dlg.tools.close,
text: 'Close'
});
var okBtn = dlg.fbar.find(top.Ext.MessageBox.buttonText.ok)[0];
Ext.QuickTips.register({
target: [okBtn.btnEl, okBtn.btnEl.parent('.x-btn-mc')],
text: 'OK'
});

Ext.QuickTips.register({
target: dlg.body.child('.ext-mb-icon'),
text: 'Info'
});

Ext.MessageBox.show(baseParams);
},
confirm: function(extraParam) {
var baseParams = {
title: 'Confirm',
cls:'cl-alert-warn'
};

Ext.apply(baseParams, extraParam);
var dlg = Ext.MessageBox.getDialog();
Ext.QuickTips.register({
target: dlg.tools.close,
text: 'Close'
});

var yesBtn = dlg.fbar.find(Ext.MessageBox.buttonText.yes)[0];
Ext.QuickTips.register({
target: [yesBtn.btnEl, yesBtn.btnEl.parent('.x-btn-mc')],
text: 'Yes'
});

var noBtn = dlg.fbar.find(Ext.MessageBox.buttonText.no)[0];
Ext.QuickTips.register({
target: [noBtn.btnEl, noBtn.btnEl.parent('.x-btn-mc')],
text: 'No'
});

Ext.QuickTips.register({
target: dlg.body.child('.ext-mb-icon'),
text: 'Confirm'
});


Ext.MessageBox.confirm(baseParams.title, baseParams.msg, baseParams.fn, baseParams.scope);
},
warnConfirm: function(extraParam) {
var baseParams = {
title: 'confirm'
};
Ext.apply(baseParams, extraParam);

Ext.apply(baseParams, extraParam);
var dlg = Ext.MessageBox.getDialog();
Ext.QuickTips.register({
target: dlg.tools.close,
text: 'close'
});

var yesBtn = dlg.fbar.find(Ext.MessageBox.buttonText.yes)[0];
Ext.QuickTips.register({
target: [yesBtn.btnEl, yesBtn.btnEl.parent('.x-btn-mc')],
text: 'Yes'
});

var noBtn = dlg.fbar.find(Ext.MessageBox.buttonText.no)[0];
Ext.QuickTips.register({
target: [noBtn.btnEl, noBtn.btnEl.parent('.x-btn-mc')],
text: 'No'
});

Ext.QuickTips.register({
target: dlg.body.child('.ext-mb-icon'),
text: 'Info'
});

Ext.MessageBox.show(baseParams);
}
}
-----------------------------------------------------------------------

Please help. Its urgent.