6 Ext.onReady(function(){
8 Ext.define('example.contact', {
9 extend: 'Ext.data.Model',
11 {name: 'first', mapping: 'name > first'},
12 {name: 'last', mapping: 'name > last'},
13 'company', 'email', 'state',
14 {name: 'dob', type: 'date', dateFormat: 'm/d/Y'}
18 Ext.define('example.fielderror', {
19 extend: 'Ext.data.Model',
23 var formPanel = Ext.create('Ext.form.Panel', {
37 // configure how to read the XML data
38 reader : Ext.create('Ext.data.reader.Xml', {
39 model: 'example.contact',
41 successProperty: '@success'
44 // configure how to read the XML errors
45 errorReader: Ext.create('Ext.data.reader.Xml', {
46 model: 'example.fielderror',
48 successProperty: '@success'
53 title: 'Contact Information',
54 defaultType: 'textfield',
59 fieldLabel: 'First Name',
60 emptyText: 'First Name',
63 fieldLabel: 'Last Name',
64 emptyText: 'Last Name',
67 fieldLabel: 'Company',
77 store: Ext.create('Ext.data.ArrayStore', {
78 fields: ['abbr', 'state'],
79 data : Ext.example.states // from states.js
82 displayField: 'state',
85 emptyText: 'Select a state...'
88 fieldLabel: 'Date of Birth',
98 formPanel.getForm().load({
99 url: 'xml-form-data.xml',
100 waitMsg: 'Loading...'
108 this.up('form').getForm().submit({
109 url: 'xml-form-errors.xml',
110 submitEmptyText: false,
111 waitMsg: 'Saving Data...'