3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
19 Ext.onReady(function() {
21 // Add the additional 'advanced' VTypes
22 Ext.apply(Ext.form.field.VTypes, {
23 daterange: function(val, field) {
24 var date = field.parseDate(val);
29 if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
30 var start = field.up('form').down('#' + field.startDateField);
31 start.setMaxValue(date);
33 this.dateRangeMax = date;
35 else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
36 var end = field.up('form').down('#' + field.endDateField);
37 end.setMinValue(date);
39 this.dateRangeMin = date;
42 * Always return true since we're only using this vtype to set the
43 * min/max allowed values (these are tested for after the vtype test)
48 daterangeText: 'Start date must be less than end date',
50 password: function(val, field) {
51 if (field.initialPassField) {
52 var pwd = field.up('form').down('#' + field.initialPassField);
53 return (val == pwd.getValue());
58 passwordText: 'Passwords do not match'
62 * ================ Date Range =======================
65 var dr = Ext.create('Ext.FormPanel', {
69 bodyPadding: '5px 5px 0',
79 defaultType: 'datefield',
82 fieldLabel: 'Start Date',
86 endDateField: 'enddt' // id of the end date field
89 fieldLabel: 'End Date',
93 startDateField: 'startdt' // id of the start date field
100 * ================ Password Verification =======================
103 var pwd = Ext.create('Ext.FormPanel', {
106 title: 'Password Verification',
107 bodyPadding: '5px 5px 0',
116 inputType: 'password'
118 defaultType: 'textfield',
121 fieldLabel: 'Password',
126 fieldLabel: 'Confirm Password',
129 initialPassField: 'pass' // id of the initial password field