3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
7 // Add the additional 'advanced' VTypes
8 Ext.apply(Ext.form.VTypes, {
9 daterange : function(val, field) {
10 var date = field.parseDate(val);
15 if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
16 var start = Ext.getCmp(field.startDateField);
17 start.setMaxValue(date);
19 this.dateRangeMax = date;
21 else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
22 var end = Ext.getCmp(field.endDateField);
23 end.setMinValue(date);
25 this.dateRangeMin = date;
28 * Always return true since we're only using this vtype to set the
29 * min/max allowed values (these are tested for after the vtype test)
34 password : function(val, field) {
35 if (field.initialPassField) {
36 var pwd = Ext.getCmp(field.initialPassField);
37 return (val == pwd.getValue());
42 passwordText : 'Passwords do not match'
46 Ext.onReady(function(){
50 // turn on validation errors beside the field globally
51 Ext.form.Field.prototype.msgTarget = 'side';
53 var bd = Ext.getBody();
56 * ================ Date Range =======================
59 var dr = new Ext.FormPanel({
63 bodyStyle:'padding:5px 5px 0',
65 defaults: {width: 175},
66 defaultType: 'datefield',
68 fieldLabel: 'Start Date',
72 endDateField: 'enddt' // id of the end date field
74 fieldLabel: 'End Date',
78 startDateField: 'startdt' // id of the start date field
85 * ================ Password Verification =======================
88 var pwd = new Ext.FormPanel({
91 title: 'Password Verification',
92 bodyStyle:'padding:5px 5px 0',
98 defaultType: 'textfield',
100 fieldLabel: 'Password',
104 fieldLabel: 'Confirm Password',
107 initialPassField: 'pass' // id of the initial password field