PDA

View Full Version : problem with ext form panel



newusername
22 Feb 2013, 1:42 AM
I don't know what is wrong with the following code ..



Ext.onReady(function()
{
var myForm = Ext.extend(Ext.FormPanel,{
title : 'login Form',
items : [
{
fieldLabel : 'User Name',
xtype : 'textfield',
name : 'uName',
allowBlank : false
}
] ,
/*constructor : function (config){
config = config || {};
Ext.apply(this,config);
}*/

initComponent: function(){
myForm.superclass.initComponent.call(this);
}

});


var f = new myForm();
f.render(document.body);
});


Please help me out..

sword-it
23 Feb 2013, 5:36 AM
Hi newusername,

Try the following code-


Ext.onReady(function(){
var tab2 = new Ext.FormPanel({
cls: 'two-column-form',
labelAlign: 'left',
labelStyle: 'font-weight:bold;',
labelWidth: 85,
title: 'formname',
bodyStyle:'padding:5px',
scrollable:'true',
border:'true',
width: 500,
height:400,
defaults: {layout: 'form', border: false},

items: [{
itemCls: 'x-clear-left',
xtype:'combo',
fieldLabel: 'Company',
name: 'company',
value: 'Ext JS'
}
],
buttons: [
{
text: 'Save'
},{
text: 'Cancel'
}
]
});


tab2.render(document.body);


});




here is working sample example -http://jsfiddle.net/4tcbu/