4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
11 Roo.onReady(function(){
15 // turn on validation errors beside the field globally
16 Roo.form.Field.prototype.msgTarget = 'side';
18 var fs = new Roo.form.Form({
19 //labelAlign: 'right',
21 waitMsgTarget: 'box-bd',
23 // configure how to read the XML Data
24 reader : new Roo.data.XmlReader({
28 {name: 'first', mapping:'name/first'}, // custom mapping
29 {name: 'last', mapping:'name/last'},
30 'company', 'email', 'state',
31 {name: 'dob', type:'date', dateFormat:'m/d/Y'} // custom data types
34 // reusable eror reader class defined at the end of this file
35 errorReader: new Roo.form.XmlErrorReader()
39 {legend:'Contact Information'},
40 new Roo.form.TextField({
41 fieldLabel: 'First Name',
46 new Roo.form.TextField({
47 fieldLabel: 'Last Name',
52 new Roo.form.TextField({
53 fieldLabel: 'Company',
58 new Roo.form.TextField({
65 new Roo.form.ComboBox({
68 store: new Roo.data.SimpleStore({
69 fields: ['abbr', 'state'],
70 data : Roo.exampledata.states // from states.js
77 emptyText:'Select a state...',
82 new Roo.form.DateField({
83 fieldLabel: 'Date of Birth',
91 fs.addButton('Load', function(){
92 fs.load({url:'xml-form.xml', waitMsg:'Loading'});
96 var submit = fs.addButton({
100 fs.submit({url:'xml-errors.xml', waitMsg:'Saving Data...'});
104 fs.render('form-ct');
107 actioncomplete: function(form, action){
108 if(action.type == 'load'){
116 // A reusable error reader class for XML forms
117 Roo.form.XmlErrorReader = function(){
118 Roo.form.XmlErrorReader.superclass.constructor.call(this, {
126 Roo.extend(Roo.form.XmlErrorReader, Roo.data.XmlReader);