Hi,
this may seem to be silly topic for you, but I spent 20 hours on this problem and I couldn't find solution.
I was looking for similar problem in forum, api and other documentation/examples.
I wanted to create a hidden (not shown) form, that would be submited in some special cases.
That's why I've created a class:
Code:
LogoutForm = function(){
this.init();
};
LogoutForm.prototype = {
form : Ext.emptyFn,
init : function() {
this.form = new Ext.form.BasicForm({
url : 'index.php',
defaultType : 'hidden',
items : [{
xtype : 'hidden',
name : 'error_msg',
value : 'Session expired, please log in again.',
allowBlank : true
},{
xtype : 'hidden',
name : 'sid',
value : 'sid_over_here',
allowBlank : true
}],
standardSubmit : true
});
},
doTimeout : function() {
Ext.get(document.body).mask('logging out...');
this.form.getForm().getEl().dom.action = MAIN_INDEX_PAGE + 'index.php';
this.form.getForm().submit({
//params: { error_msg: 'Session expired, log in again please.'},
method: 'POST'
});
},
doLogout : function(sid) {
this.form.getForm().getEl().dom.action = MAIN_INDEX_PAGE + 'logout.php';
this.form.getForm().submit({
//params: { error_msg: 'Logged out successfuly.', sid : sid},
method: 'POST'
});
}
};
MAIN_INDEX_PAGE is set to contain the web page address.
So, somewhere at my page, in some special cases, I want to submit this form.
In these cases I call a function with such code:
Code:
var form = new LogoutForm();
form.doTimeout();
The thing is, form is not submitted and some errors appears.
I can't get the reason.
I get following error on FFX's console:
Code:
this.el is null
initComponent()(Object url=index.php defaultType=hidden items=[2])ext-all.js (wiersz 135)
initComponent()(Object url=index.php defaultType=hidden items=[2], undefined)ext-all.js (wiersz 135)
init()()jsonErro...Reader.js (wiersz 28)
LogoutForm()()jsonErro...Reader.js (wiersz 9)
logoutAction()()main.js....cdbf1db76 (wiersz 3)
EventManager()()ext-all.js (wiersz 12)
EventManager()()ext-all.js (wiersz 12)
TextItem()(Object browserEvent=Event mouseout button=0 type=mouseout)ext-all.js (wiersz 113)
MenuMgr()(Object browserEvent=Event mouseout button=0 type=mouseout)ext-all.js (wiersz 111)
camelFn()()ext-all.js (wiersz 13)
apply()()ext-base.js (wiersz 9)
[IMG]chrome://firebug/content/blank.gif[/IMG]Ext.form.BasicForm=function(B,A){Ext.app...his}});Ext.BasicForm=Ext.form.BasicForm;
Line 28 points to line with standardSubmit : true inside init() method of class.
If I comment lines with:
Code:
this.form.getForm().getEl().dom.action = CRM_MAIN_INDEX_PAGE + 'index.php';
problem does not disappear.
What I do wrong?
Please help!