PDA

View Full Version : Problem with form submit in a tab



atm779
6 Jul 2009, 3:22 AM
Problem with form submition in a tab

Here is my form


var fs = new Ext.FormPanel({
region : 'center',
frame : true,
title : title,
waitMsgTarget : false,

labelAlign : 'top',
width : '100%',

id: 'pId',
iconCls: 'tabIco',
//closable:true,

defaultType : 'fieldset',
defaults : {autoHeight:true,anchor:'100%'},
items: [{
defaults: {anchor:'100%',allowBlank : false},
title: '??????? ??????? ???????? ?????',
items: [{
xtype : 'textfield',
fieldLabel : '?????????',
name : 'name'
},{
name : 'text',
xtype : 'htmleditor',
height : 300,
fieldLabel : '?????'
}
]
},{
title : '?????????????',
defaults : {anchor:'100%'},
defaultType : 'textfield',
collapsible : true,
collapsed : true,
items :[{
fieldLabel : '???????? ????? (meta keywords)',
name : 'keywords',
allowBlank : false
},{
fieldLabel : '???????? (meta description)',
name : 'description'
},{
fieldLabel : '???? (title)',
name : 'title'
}
]
}
]
});
fs.addButton('Load', function(){
fs.form.load({
url : 'a7c.a.edit.php',
method : 'GET',
waitMsg : 'Loading',
params : { table : 'page_data', id : '1' },
success : function(form, action) {
Ext.MessageBox.alert('Message', 'Loaded OK');
},
failure : function(form, action) {
Ext.MessageBox.alert('Message', 'Load failed');
}
});
});
fs.addButton('Submit', function(){
fs.form.submit({
url : 'a7c.a.send.php',
method : 'GET',
waitMsg : 'Saving Data',
params : { table : 'page_data', id : '1' },
success : function(form, action) {
Ext.MessageBox.alert('Message', 'Submit OK');
},
failure : function(form, action) {
Ext.MessageBox.alert('Message', 'Submit failed');
}
});
});

When I place it to a document.body it works just great. But when I place this FormPanel inside the tab it always says 'Submit failed' and form never gets submitted.
What am I doing wrong ?

6 Jul 2009, 3:29 AM
Well that means that something is wrong with your submission. have you debugged your code?!?! your server must be returning something incorrectly.

atm779
6 Jul 2009, 3:50 AM
What can be wrong with this code?



fs.form.submit({
url : 'a7c.a.send.php',
method : 'GET',
waitMsg : 'Saving Data',
params : { table : 'page_data', id : '1' },
success : function(form, action) {
Ext.MessageBox.alert('Message', 'Submit OK');
},
failure : function(form, action) {
Ext.MessageBox.alert('Message', 'Submit failed');
}
});



Server always returns {success: true}

But it looks like submission never reaches a7c.a.send.php and it is never get to be executed only when I try to submit from a tab. Are there any special features with tabs ?

6 Jul 2009, 3:52 AM
no, there are no special features with the tabs.

look at the return from firebug, there has to be something not right with the return data -either it's malformed or the PHP is returning something that is invalid.

Animal
6 Jul 2009, 4:24 AM
Submit using POST

atm779
6 Jul 2009, 4:24 AM
There is no errors seen by the FireBug.
I've check out for XMLHttpRequests, there is no request happens for fs.getForm().submit(). Also I see that there is no submit method for Ext.FormPanel, there is this method only for Ext.form.BasicForm. May be this is the thing?

atm779
6 Jul 2009, 4:25 AM
submit using POST doesn't work either =(

6 Jul 2009, 4:30 AM
fs.form == fs.getForm() == Ext.form.BasicForm !


That said, you're doing something wrong and you need to step through your cocde.

Condor
6 Jul 2009, 4:31 AM
What is the value of action.failureType when the submit fails?

If you don't see a submit then I suspect that it's 'client' (indicating a validation error).

Also, be careful with method:'GET', because the browser will cache those requests and not actually send anything to the server!

atm779
6 Jul 2009, 4:42 AM
action.failureType says "client"

Condor
6 Jul 2009, 4:44 AM
So the validation fails for one of your fields. Which of your fields is marked invalid?

atm779
6 Jul 2009, 5:01 AM
????????????????????????????????????????????????????????????????! =D>

this is just excellent there was invisible field with par "allowBlank : false" !!! So dummy!!!

Thanx a lot =))))