2 * @example Form Submission
5 Ext.require('Ext.form.Panel');
6 Ext.require('Ext.form.field.Date');
8 Ext.onReady(function() {
9 Ext.create('Ext.form.Panel', {
10 renderTo: Ext.getBody(),
15 defaultType: 'textfield',
16 // The form will submit an AJAX request to this URL when submitted
20 fieldLabel: 'First Name',
24 fieldLabel: 'Last Name',
29 fieldLabel: 'Date of Birth',
37 var form = this.up('form').getForm(); // get the basic form
38 if (form.isValid()) { // make sure the form contains valid data before submitting
40 success: function(form, action) {
41 Ext.Msg.alert('Success', action.result.msg);
43 failure: function(form, action) {
44 Ext.Msg.alert('Failed', action.result.msg);
47 } else { // display error alert if the data is invalid
48 Ext.Msg.alert('Invalid Data', 'Please correct form errors.')