3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.ns('Ext.app');
\r
10 Ext.app.ContactForm = Ext.extend(Ext.FormPanel, {
\r
11 formTitle: 'Contact Information (English)',
\r
12 firstName: 'First Name',
\r
13 lastName: 'Surname',
\r
14 surnamePrefix: 'Surname Prefix',
\r
17 stateEmptyText: 'Choose a state...',
\r
19 birth: 'Date of Birth',
\r
23 initComponent : function(config) {
\r
25 labelWidth: 100, // label settings here cascade unless overridden
\r
26 url:'save-form.php',
\r
28 title: this.formTitle,
\r
29 bodyStyle:'padding:5px 5px 0',
\r
31 defaults: {width: 220},
\r
32 defaultType: 'textfield',
\r
35 fieldLabel: this.firstName,
\r
39 fieldLabel: this.lastName,
\r
42 fieldLabel: this.surnamePrefix,
\r
44 name: 'surnamePrefix'
\r
46 fieldLabel: this.company,
\r
48 }, new Ext.form.ComboBox({
\r
49 fieldLabel: this.province,
\r
50 hiddenName: 'state',
\r
51 store: new Ext.data.ArrayStore({
\r
52 fields: ['provincie'],
\r
53 data : Ext.exampledata.dutch_provinces // from dutch-provinces.js
\r
55 displayField: 'provincie',
\r
58 triggerAction: 'all',
\r
59 emptyText: this.stateEmtyText,
\r
63 fieldLabel: this.email,
\r
66 }, new Ext.form.DateField({
\r
67 fieldLabel: this.birth,
\r
79 Ext.app.ContactForm.superclass.initComponent.apply(this, arguments);
\r
83 Ext.onReady(function(){
\r
84 Ext.QuickTips.init();
\r
86 // turn on validation errors beside the field globally
\r
87 Ext.form.Field.prototype.msgTarget = 'side';
\r
89 var bd = Ext.getBody();
\r
91 bd.createChild({tag: 'h2', html: 'Localized Contact Form'});
\r
94 var simple = new Ext.app.ContactForm();
\r
95 simple.render(document.body);
\r