I have a form panel and a button.i want to add a field in the form when the button is clicked..here is the model
Code:
Ext.regModel('Contact', {
idProperty: 'id',
fields: [
{ name: 'name', type: 'string' },
{ name: 'phone', type: 'string' },
{ name: 'email', type: 'string' },
{ name: 'address', type: 'string' },
],
validations: [
{ type: 'presence', field: 'name', message: 'Please Enter A Contact Name' },
{ type: 'format', field: 'phone', message: 'Please Enter Phone Number', matcher: /[0-9]/ }
]
});
and here is the form
Code:
AddressBook.views.contactEditor = new Ext.form.FormPanel({ id: 'contactEditor',
items: [
{
xtype: 'textfield',
name: 'name',
label: 'Name',
required: true
},
{
xtype: 'textfield',
name: 'phone',
label: 'Phone',
required: true
},
{
xtype: 'emailfield',
name: 'email',
label: 'Email'
},
{
xtype: 'textareafield',
name: 'address',
label: 'Address'
},
],
dockedItems: [
AddressBook.views.contactEditorTopToolbar,
AddressBook.views.contactEditorBottomToolbar,
]
});
i want another phone field in the form when a button is clicked....can any one help..please??