vectorbai
5 Dec 2011, 5:05 PM
my code:getForm() is not function
newsForm: {
title: 'New Products',
id: 'Products-form-panel',
layout: 'fit',
bodyPadding: 15,
items: {
title: 'New Produvts Test -Add prod',
layout: 'fit',
frame: true,
items: {
xtype: 'form',
layout:'absolute',
url:'form-save.php',
padding: '0',
border: false,
cls: 'absolute-form-panel-body',
defaultType: 'textfield',
items: [{
x: 0,
y: 5,
xtype: 'label',
text: 'From:'
},{
x: 55,
y: 0,
name: 'from',
hideLabel: true,
anchor:'100%' // anchor width by %
},{
x: 0,
y: 32,
xtype: 'label',
text: 'To:'
},{
x: 55,
y: 27,
xtype: 'button',
text: 'Contacts...'
},{
x: 127,
y: 27,
name: 'to',
hideLabel: true,
anchor: '100%' // anchor width by %
},{
x: 0,
y: 59,
xtype: 'label',
text: 'Subject:'
},{
x: 55,
y: 54,
name: 'subject',
hideLabel: true,
anchor: '100%' // anchor width by %
},{
x: 0,
y: 81,
hideLabel: true,
xtype: 'textarea',
name: 'msg',
anchor: '100% 100%' // anchor width and height
}]
,
buttons: [{
text: 'Submit',
handler: function() {
// The getForm() method returns the Ext.form.Basic instance:
var form = this.up('form').getForm(); //getForm can working !
if (form.isValid()) {
// Submit the Ajax request and handle the response
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', (action.result.file));
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
}
}
}]
////
////
},
dockedItems: [
{
xtype: 'toolbar',
ignoreParentFrame: true,
ignoreBorderManagement: true,
cls: 'absolute-form-toolbar',
items: [
{
text: 'Send',
iconCls: 'icon-send'
},'-',{
text: 'Save',
iconCls: 'icon-save',
handler: function(){
//this.getForm().reset() ;
//------------------------ getForm() not work!!!!
/* Ext.getCmp('Products-form-panel').getForm().submit();*/
//-------------------------getForm() not work!!!!
}
},{
text: 'Check Spelling',
iconCls: 'icon-spell'
},'-',{
text: 'Print',
iconCls: 'icon-print'
},'->',{
text: 'Attach a File',
iconCls: 'icon-attach'
}
]
}
]
}
}
I try many methods but failue.Plz help me solve this problem
newsForm: {
title: 'New Products',
id: 'Products-form-panel',
layout: 'fit',
bodyPadding: 15,
items: {
title: 'New Produvts Test -Add prod',
layout: 'fit',
frame: true,
items: {
xtype: 'form',
layout:'absolute',
url:'form-save.php',
padding: '0',
border: false,
cls: 'absolute-form-panel-body',
defaultType: 'textfield',
items: [{
x: 0,
y: 5,
xtype: 'label',
text: 'From:'
},{
x: 55,
y: 0,
name: 'from',
hideLabel: true,
anchor:'100%' // anchor width by %
},{
x: 0,
y: 32,
xtype: 'label',
text: 'To:'
},{
x: 55,
y: 27,
xtype: 'button',
text: 'Contacts...'
},{
x: 127,
y: 27,
name: 'to',
hideLabel: true,
anchor: '100%' // anchor width by %
},{
x: 0,
y: 59,
xtype: 'label',
text: 'Subject:'
},{
x: 55,
y: 54,
name: 'subject',
hideLabel: true,
anchor: '100%' // anchor width by %
},{
x: 0,
y: 81,
hideLabel: true,
xtype: 'textarea',
name: 'msg',
anchor: '100% 100%' // anchor width and height
}]
,
buttons: [{
text: 'Submit',
handler: function() {
// The getForm() method returns the Ext.form.Basic instance:
var form = this.up('form').getForm(); //getForm can working !
if (form.isValid()) {
// Submit the Ajax request and handle the response
form.submit({
success: function(form, action) {
Ext.Msg.alert('Success', (action.result.file));
},
failure: function(form, action) {
Ext.Msg.alert('Failed', action.result.msg);
}
});
}
}
}]
////
////
},
dockedItems: [
{
xtype: 'toolbar',
ignoreParentFrame: true,
ignoreBorderManagement: true,
cls: 'absolute-form-toolbar',
items: [
{
text: 'Send',
iconCls: 'icon-send'
},'-',{
text: 'Save',
iconCls: 'icon-save',
handler: function(){
//this.getForm().reset() ;
//------------------------ getForm() not work!!!!
/* Ext.getCmp('Products-form-panel').getForm().submit();*/
//-------------------------getForm() not work!!!!
}
},{
text: 'Check Spelling',
iconCls: 'icon-spell'
},'-',{
text: 'Print',
iconCls: 'icon-print'
},'->',{
text: 'Attach a File',
iconCls: 'icon-attach'
}
]
}
]
}
}
I try many methods but failue.Plz help me solve this problem