/*!
- * Ext JS Library 3.1.1
- * Copyright(c) 2006-2010 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
*/
-// Add the additional 'advanced' VTypes\r
-Ext.apply(Ext.form.VTypes, {\r
- daterange : function(val, field) {\r
- var date = field.parseDate(val);\r
-\r
- if(!date){\r
- return;\r
- }\r
- if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {\r
- var start = Ext.getCmp(field.startDateField);\r
- start.setMaxValue(date);\r
- start.validate();\r
- this.dateRangeMax = date;\r
- } \r
- else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {\r
- var end = Ext.getCmp(field.endDateField);\r
- end.setMinValue(date);\r
- end.validate();\r
- this.dateRangeMin = date;\r
- }\r
- /*\r
- * Always return true since we're only using this vtype to set the\r
- * min/max allowed values (these are tested for after the vtype test)\r
- */\r
- return true;\r
- },\r
-\r
- password : function(val, field) {\r
- if (field.initialPassField) {\r
- var pwd = Ext.getCmp(field.initialPassField);\r
- return (val == pwd.getValue());\r
- }\r
- return true;\r
- },\r
-\r
- passwordText : 'Passwords do not match'\r
-});\r
-\r
-\r
-Ext.onReady(function(){\r
-\r
- Ext.QuickTips.init();\r
-\r
- // turn on validation errors beside the field globally\r
- Ext.form.Field.prototype.msgTarget = 'side';\r
-\r
- var bd = Ext.getBody();\r
-\r
- /*\r
- * ================ Date Range =======================\r
- */\r
- \r
- var dr = new Ext.FormPanel({\r
- labelWidth: 125,\r
- frame: true,\r
- title: 'Date Range',\r
- bodyStyle:'padding:5px 5px 0',\r
- width: 350,\r
- defaults: {width: 175},\r
- defaultType: 'datefield',\r
- items: [{\r
- fieldLabel: 'Start Date',\r
- name: 'startdt',\r
- id: 'startdt',\r
- vtype: 'daterange',\r
- endDateField: 'enddt' // id of the end date field\r
- },{\r
- fieldLabel: 'End Date',\r
- name: 'enddt',\r
- id: 'enddt',\r
- vtype: 'daterange',\r
- startDateField: 'startdt' // id of the start date field\r
- }]\r
- });\r
-\r
- dr.render('dr');\r
- \r
- /*\r
- * ================ Password Verification =======================\r
- */\r
- \r
- var pwd = new Ext.FormPanel({\r
- labelWidth: 125,\r
- frame: true,\r
- title: 'Password Verification',\r
- bodyStyle:'padding:5px 5px 0',\r
- width: 350,\r
- defaults: {\r
- width: 175,\r
- inputType: 'password'\r
- },\r
- defaultType: 'textfield',\r
- items: [{\r
- fieldLabel: 'Password',\r
- name: 'pass',\r
- id: 'pass'\r
- },{\r
- fieldLabel: 'Confirm Password',\r
- name: 'pass-cfrm',\r
- vtype: 'password',\r
- initialPassField: 'pass' // id of the initial password field\r
- }]\r
- });\r
-\r
- pwd.render('pw');\r
-});
\ No newline at end of file
+// Add the additional 'advanced' VTypes
+Ext.apply(Ext.form.VTypes, {
+ daterange : function(val, field) {
+ var date = field.parseDate(val);
+
+ if(!date){
+ return false;
+ }
+ if (field.startDateField) {
+ var start = Ext.getCmp(field.startDateField);
+ if (!start.maxValue || (date.getTime() != start.maxValue.getTime())) {
+ start.setMaxValue(date);
+ start.validate();
+ }
+ }
+ else if (field.endDateField) {
+ var end = Ext.getCmp(field.endDateField);
+ if (!end.minValue || (date.getTime() != end.minValue.getTime())) {
+ end.setMinValue(date);
+ end.validate();
+ }
+ }
+ /*
+ * Always return true since we're only using this vtype to set the
+ * min/max allowed values (these are tested for after the vtype test)
+ */
+ return true;
+ },
+
+ password : function(val, field) {
+ if (field.initialPassField) {
+ var pwd = Ext.getCmp(field.initialPassField);
+ return (val == pwd.getValue());
+ }
+ return true;
+ },
+
+ passwordText : 'Passwords do not match'
+});
+
+
+Ext.onReady(function(){
+
+ Ext.QuickTips.init();
+
+ // turn on validation errors beside the field globally
+ Ext.form.Field.prototype.msgTarget = 'side';
+
+ var bd = Ext.getBody();
+
+ /*
+ * ================ Date Range =======================
+ */
+
+ var dr = new Ext.FormPanel({
+ labelWidth: 125,
+ frame: true,
+ title: 'Date Range',
+ bodyStyle:'padding:5px 5px 0',
+ width: 350,
+ defaults: {width: 175},
+ defaultType: 'datefield',
+ items: [{
+ fieldLabel: 'Start Date',
+ name: 'startdt',
+ id: 'startdt',
+ vtype: 'daterange',
+ endDateField: 'enddt' // id of the end date field
+ },{
+ fieldLabel: 'End Date',
+ name: 'enddt',
+ id: 'enddt',
+ vtype: 'daterange',
+ startDateField: 'startdt' // id of the start date field
+ }]
+ });
+
+ dr.render('dr');
+
+ /*
+ * ================ Password Verification =======================
+ */
+
+ var pwd = new Ext.FormPanel({
+ labelWidth: 125,
+ frame: true,
+ title: 'Password Verification',
+ bodyStyle:'padding:5px 5px 0',
+ width: 350,
+ defaults: {
+ width: 175,
+ inputType: 'password'
+ },
+ defaultType: 'textfield',
+ items: [{
+ fieldLabel: 'Password',
+ name: 'pass',
+ id: 'pass'
+ },{
+ fieldLabel: 'Confirm Password',
+ name: 'pass-cfrm',
+ vtype: 'password',
+ initialPassField: 'pass' // id of the initial password field
+ }]
+ });
+
+ pwd.render('pw');
+});