You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.4 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. Ext.ns('Ext.app');
  16. Ext.app.ContactForm = Ext.extend(Ext.FormPanel, {
  17. formTitle: 'Contact Information (English)',
  18. firstName: 'First Name',
  19. lastName: 'Surname',
  20. surnamePrefix: 'Surname Prefix',
  21. company: 'Company',
  22. state: 'State',
  23. stateEmptyText: 'Choose a state...',
  24. email: 'E-mail',
  25. birth: 'Date of Birth',
  26. save: 'Save',
  27. cancel: 'Cancel',
  28. initComponent : function(config) {
  29. Ext.apply(this, {
  30. labelWidth: 100, // label settings here cascade unless overridden
  31. url:'save-form.php',
  32. frame:true,
  33. title: this.formTitle,
  34. bodyStyle:'padding:5px 5px 0',
  35. width: 370,
  36. defaults: {width: 220},
  37. defaultType: 'textfield',
  38. items: [{
  39. fieldLabel: this.firstName,
  40. name: 'firstname',
  41. allowBlank:false
  42. },{
  43. fieldLabel: this.lastName,
  44. name: 'lastName'
  45. },{
  46. fieldLabel: this.surnamePrefix,
  47. width: 50,
  48. name: 'surnamePrefix'
  49. },{
  50. fieldLabel: this.company,
  51. name: 'company'
  52. }, new Ext.form.ComboBox({
  53. fieldLabel: this.province,
  54. hiddenName: 'state',
  55. store: new Ext.data.ArrayStore({
  56. fields: ['provincie'],
  57. data : Ext.exampledata.dutch_provinces // from dutch-provinces.js
  58. }),
  59. displayField: 'provincie',
  60. typeAhead: true,
  61. mode: 'local',
  62. triggerAction: 'all',
  63. emptyText: this.stateEmtyText,
  64. selectOnFocus:true,
  65. width:190
  66. }), {
  67. fieldLabel: this.email,
  68. name: 'email',
  69. vtype:'email'
  70. }, new Ext.form.DateField({
  71. fieldLabel: this.birth,
  72. name: 'birth'
  73. })
  74. ],
  75. buttons: [{
  76. text: this.save
  77. },{
  78. text: this.cancel
  79. }]
  80. });
  81. Ext.app.ContactForm.superclass.initComponent.apply(this, arguments);
  82. }
  83. });
  84. Ext.onReady(function(){
  85. Ext.QuickTips.init();
  86. // turn on validation errors beside the field globally
  87. Ext.form.Field.prototype.msgTarget = 'side';
  88. var bd = Ext.getBody();
  89. bd.createChild({tag: 'h2', html: 'Localized Contact Form'});
  90. // simple form
  91. var simple = new Ext.app.ContactForm();
  92. simple.render(document.body);
  93. });