forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidators.js
More file actions
33 lines (25 loc) · 893 Bytes
/
Copy pathvalidators.js
File metadata and controls
33 lines (25 loc) · 893 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
/*App.Validate.form = function(values){
if(values.IP_ADDRESS == '') {
return alert('Not correct ip');
}
return true;
}*/
App.Validate.Is = {
ip: function(object) {
var ip_regexp = new RegExp(/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/);
return ip_regexp.test() ? false : App.i18n.getMessage('incorrect_ip');
}
};
App.Validate.form = function(values, form_ref){
// TODO: validate it!
return true;
var errors = [];
$.each(values, function(key) {
var value = values[key];
/*if ('undefined' != typeof App.Validate.Is[key] ) {
if(var error = App.Validate.Is[key](value)) {
errors[erros.length++] = error;
}
}*/
});
}