Creating a FormPanel component

The FormPanel component is a very specialized version of the Ext.Container component, and as the name implies, it is designed to handle form elements. Unlike panels and containers, you don't need to specify the layout for formpanel. It automatically uses its own special form layout.

A basic example of creating a formpanel component is as follows:

var form = Ext.create('Ext.form.FormPanel', {
 items: [
   xtype: 'textfield',
   name : 'first',
   label: 'First name'
   xtype: 'textfield',
   name : 'last',
   label: 'Last name'
   xtype: 'emailfield',
   name : 'email',
   label: 'Email'

For this example, we just create the panel and add items for each field in the form. Our xtype tells the form what type of field to create. ...

Get Sencha Touch 2 Mobile JavaScript Framework now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.