PDA

View Full Version : i am new to extjs...someone guide me can? i have form but don't know how to function



dannyg
3 Dec 2009, 12:05 AM
/*!
* Ext JS Library 3.0.0
* Copyright(c) 2006-2009 Ext JS, LLC
* [email protected]
* http://www.extjs.com/license
*/
Ext.onReady(function(){

Ext.QuickTips.init();

// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';

var bd = Ext.getBody();

/*
* ================ Form 5 =======================
*/
//bd.createChild({tag: 'h2', html: 'Form 5 - ... and forms can contain TabPanel(s)'});

var form = new Ext.FormPanel({
labelAlign: 'center',
title: 'New Project',
bodyStyle:'padding:10px',
width: 450,
items: [{
layout:'column',
border:false,
items:[{
//columnWidth:.5,
layout: 'form',
border:false,
width: 430,
items: [{
xtype:'numberfield',
fieldLabel: 'Project ID',
name: 'project_id',
//anchor:'95%',
allowBlank:false
}, {
xtype:'numberfield',
fieldLabel: 'Number of step',
name: 'step_number',
width: 80,
//anchor:'95%',
allowBlank:false
},{
buttons: [{
text: 'Proceed'
}]}
]
}]
},{
xtype:'tabpanel',
plain:true,
activeTab: 0,
//height:335,
defaults:{bodyStyle:'padding:10px'},
items:[{
title:'Project Step #',
layout:'form',
width: 300,
//defaultType: 'textfield',

items: [{
fieldLabel: 'Project Name',
name: 'project_name',
xtype: 'textfield',
width: 280,
allowBlank:false
},{
fieldLabel: 'Description',
name: 'description',
xtype: 'textarea',
height: 200,
width: 280,
allowBlank:false
},{
fieldLabel: 'Number of parameter',
name: 'parameter_number',
xtype: 'numberfield',
width: 80,
allowBlank:false
},{
buttons: [{
text: 'Reset',
handler: function(){
form.getForm().reset();
}
},{
text: 'Next'
}]
}]
}]
}],

buttons: [{
text: 'Save and exit',
width: 100
}]
});

form.render(document.body);
});

CrazyEnigma
3 Dec 2009, 7:46 AM
You might want to read the sticky (http://www.extjs.com/forum/showthread.php?t=66423)first before posting.

Your code is not formatted, so it's hard to read, neither just posting your entire code will help us either, but check out the API (http://www.extjs.com/deploy/dev/docs/) searching for BasicForm or FormPanel, because this will help you immensely with adding functions to your form (look under the events). If you are still having problems, check out these Tutorials (http://www.extjs.com/learn/Tutorials).