PageRenderTime 26ms CodeModel.GetById 13ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/source/Plug-in/ext/adv-vtypes.js

http://prosporous.googlecode.com/
JavaScript | 45 lines | 29 code | 4 blank | 12 comment | 12 complexity | fde2ca9168c033dc0455f759fceee4b1 MD5 | raw file
 1/*
 2 * Ext JS Library 2.2
 3 * Copyright(c) 2006-2008, Ext JS, LLC.
 4 * licensing@extjs.com
 5 *
 6 * http://extjs.com/license
 7 */
 8
 9// Add the additional 'advanced' VTypes
10Ext.apply(Ext.form.VTypes, {
11    daterange : function(val, field) {
12        var date = field.parseDate(val);
13
14        if(!date){
15            return;
16        }
17        if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
18            var start = Ext.getCmp(field.startDateField);
19            start.setMaxValue(date);
20            start.validate();
21            this.dateRangeMax = date;
22        }
23        else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
24            var end = Ext.getCmp(field.endDateField);
25            end.setMinValue(date);
26            end.validate();
27            this.dateRangeMin = date;
28        }
29        /*
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)
32         */
33        return true;
34    },
35
36    password : function(val, field) {
37        if (field.initialPassField) {
38            var pwd = Ext.getCmp(field.initialPassField);
39            return (val == pwd.getValue());
40        }
41        return true;
42    },
43
44    passwordText : '????????'
45});