3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">// Add the additional 'advanced' VTypes
\r
9 Ext.apply(Ext.form.VTypes, {
\r
10 daterange : function(val, field) {
\r
11 var date = field.parseDate(val);
\r
16 if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
\r
17 var start = Ext.getCmp(field.startDateField);
\r
18 start.setMaxValue(date);
\r
20 this.dateRangeMax = date;
\r
22 else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
\r
23 var end = Ext.getCmp(field.endDateField);
\r
24 end.setMinValue(date);
\r
26 this.dateRangeMin = date;
\r
29 * Always return true since we're only using this vtype to set the
\r
30 * min/max allowed values (these are tested for after the vtype test)
\r
35 password : function(val, field) {
\r
36 if (field.initialPassField) {
\r
37 var pwd = Ext.getCmp(field.initialPassField);
\r
38 return (val == pwd.getValue());
\r
43 passwordText : 'Passwords do not match'
\r
47 Ext.onReady(function(){
\r
49 Ext.QuickTips.init();
\r
51 // turn on validation errors beside the field globally
\r
52 Ext.form.Field.prototype.msgTarget = 'side';
\r
54 var bd = Ext.getBody();
\r
57 * ================ Date Range =======================
\r
60 var dr = new Ext.FormPanel({
\r
63 title: 'Date Range',
\r
64 bodyStyle:'padding:5px 5px 0',
\r
66 defaults: {width: 175},
\r
67 defaultType: 'datefield',
\r
69 fieldLabel: 'Start Date',
\r
73 endDateField: 'enddt' // id of the end date field
\r
75 fieldLabel: 'End Date',
\r
79 startDateField: 'startdt' // id of the start date field
\r
86 * ================ Password Verification =======================
\r
89 var pwd = new Ext.FormPanel({
\r
92 title: 'Password Verification',
\r
93 bodyStyle:'padding:5px 5px 0',
\r
97 inputType: 'password'
\r
99 defaultType: 'textfield',
\r
101 fieldLabel: 'Password',
\r
105 fieldLabel: 'Confirm Password',
\r
108 initialPassField: 'pass' // id of the initial password field
\r