3
* Copyright(c) 2006-2009 Ext JS, LLC
5
* http://www.extjs.com/license
7
Ext.onReady(function(){
11
// turn on validation errors beside the field globally
12
Ext.form.Field.prototype.msgTarget = 'side';
14
var fs = new Ext.FormPanel({
22
// configure how to read the XML Data
23
reader : new Ext.data.XmlReader({
27
{name: 'first', mapping:'name/first'}, // custom mapping
28
{name: 'last', mapping:'name/last'},
29
'company', 'email', 'state',
30
{name: 'dob', type:'date', dateFormat:'m/d/Y'} // custom data types
33
// reusable eror reader class defined at the end of this file
34
errorReader: new Ext.form.XmlErrorReader(),
37
new Ext.form.FieldSet({
38
title: 'Contact Information',
40
defaultType: 'textfield',
42
fieldLabel: 'First Name',
46
fieldLabel: 'Last Name',
50
fieldLabel: 'Company',
60
new Ext.form.ComboBox({
63
store: new Ext.data.ArrayStore({
64
fields: ['abbr', 'state'],
65
data : Ext.exampledata.states // from states.js
72
emptyText:'Select a state...',
77
new Ext.form.DateField({
78
fieldLabel: 'Date of Birth',
89
fs.addButton('Load', function(){
90
fs.getForm().load({url:'xml-form.xml', waitMsg:'Loading'});
94
var submit = fs.addButton({
98
fs.getForm().submit({url:'xml-errors.xml', waitMsg:'Saving Data...'});
102
fs.render('form-ct');
105
actioncomplete: function(form, action){
106
if(action.type == 'load'){
114
// A reusable error reader class for XML forms
115
Ext.form.XmlErrorReader = function(){
116
Ext.form.XmlErrorReader.superclass.constructor.call(this, {
124
Ext.extend(Ext.form.XmlErrorReader, Ext.data.XmlReader);
b'\\ No newline at end of file'