3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.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) {
16 var start = Ext.getCmp(field.startDateField);
17 if (!start.maxValue || (date.getTime() != start.maxValue.getTime())) {
18 start.setMaxValue(date);
22 else if (field.endDateField) {
23 var end = Ext.getCmp(field.endDateField);
24 if (!end.minValue || (date.getTime() != end.minValue.getTime())) {
25 end.setMinValue(date);
30 * Always return true since we're only using this vtype to set the
31 * min/max allowed values (these are tested for after the vtype test)
36 password : function(val, field) {
37 if (field.initialPassField) {
38 var pwd = Ext.getCmp(field.initialPassField);
39 return (val == pwd.getValue());
44 passwordText : 'Passwords do not match'
48 Ext.onReady(function(){
52 // turn on validation errors beside the field globally
53 Ext.form.Field.prototype.msgTarget = 'side';
55 var bd = Ext.getBody();
58 * ================ Date Range =======================
61 var dr = new Ext.FormPanel({
65 bodyStyle:'padding:5px 5px 0',
67 defaults: {width: 175},
68 defaultType: 'datefield',
70 fieldLabel: 'Start Date',
74 endDateField: 'enddt' // id of the end date field
76 fieldLabel: 'End Date',
80 startDateField: 'startdt' // id of the start date field
87 * ================ Password Verification =======================
90 var pwd = new Ext.FormPanel({
93 title: 'Password Verification',
94 bodyStyle:'padding:5px 5px 0',
100 defaultType: 'textfield',
102 fieldLabel: 'Password',
106 fieldLabel: 'Confirm Password',
109 initialPassField: 'pass' // id of the initial password field