3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
20 Ext.onReady(function(){
22 Ext.define('example.contact', {
23 extend: 'Ext.data.Model',
25 {name: 'first', mapping: 'name > first'},
26 {name: 'last', mapping: 'name > last'},
27 'company', 'email', 'state',
28 {name: 'dob', type: 'date', dateFormat: 'm/d/Y'}
32 Ext.define('example.fielderror', {
33 extend: 'Ext.data.Model',
37 var formPanel = Ext.create('Ext.form.Panel', {
51 // configure how to read the XML data
52 reader : Ext.create('Ext.data.reader.Xml', {
53 model: 'example.contact',
55 successProperty: '@success'
58 // configure how to read the XML errors
59 errorReader: Ext.create('Ext.data.reader.Xml', {
60 model: 'example.fielderror',
62 successProperty: '@success'
67 title: 'Contact Information',
68 defaultType: 'textfield',
73 fieldLabel: 'First Name',
74 emptyText: 'First Name',
77 fieldLabel: 'Last Name',
78 emptyText: 'Last Name',
81 fieldLabel: 'Company',
91 store: Ext.create('Ext.data.ArrayStore', {
92 fields: ['abbr', 'state'],
93 data : Ext.example.states // from states.js
96 displayField: 'state',
99 emptyText: 'Select a state...'
102 fieldLabel: 'Date of Birth',
113 formPanel.getForm().load({
114 url: 'xml-form-data.xml',
115 waitMsg: 'Loading...'
123 this.up('form').getForm().submit({
124 url: 'xml-form-errors.xml',
125 submitEmptyText: false,
126 waitMsg: 'Saving Data...'