-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileUploadField.js
More file actions
33 lines (29 loc) · 981 Bytes
/
FileUploadField.js
File metadata and controls
33 lines (29 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
if (!Paims.component)
Ext.namespace('Paims.component');
Paims.component.FileUploadField = function (params) {
Paims.component.FileUploadField.superclass.constructor.call(this, params);
}
Ext.extend(Paims.component.FileUploadField, Ext.form.FileUploadField, {
validator: function () {
var x = this.getValue();
if (!x)
return;
if (this.fileTypes.length == 0)
return true;
var patn = '/'
var docType = '';
for (var i = 0; i < this.fileTypes.length; i++) {
patn += '\.' + this.fileTypes[i] + '$|';
docType += this.fileTypes[i] + ',';
}
patn = patn.substring(0, patn.length - 1);
patn += '/i';
patn = eval(patn);
docType = docType.substring(0, docType.length - 1);
if (!patn.test(x)) {
this.invalidText = '只能上传' + docType + '文档。';
return false;
}
return true;
}
});