1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
1422 |
alexandre_ |
11 |
|
|
|
12 |
|
1318 |
alexandre_ |
13 |
dojo.provide("dojo.validate.web");
|
|
|
14 |
dojo.require("dojo.validate.common");
|
|
|
15 |
dojo.validate.isIpAddress = function (value, flags) {
|
|
|
16 |
var re = new RegExp("^" + dojo.regexp.ipAddress(flags) + "$", "i");
|
|
|
17 |
return re.test(value);
|
|
|
18 |
};
|
|
|
19 |
dojo.validate.isUrl = function (value, flags) {
|
|
|
20 |
var re = new RegExp("^" + dojo.regexp.url(flags) + "$", "i");
|
|
|
21 |
return re.test(value);
|
|
|
22 |
};
|
|
|
23 |
dojo.validate.isEmailAddress = function (value, flags) {
|
|
|
24 |
var re = new RegExp("^" + dojo.regexp.emailAddress(flags) + "$", "i");
|
|
|
25 |
return re.test(value);
|
|
|
26 |
};
|
|
|
27 |
dojo.validate.isEmailAddressList = function (value, flags) {
|
|
|
28 |
var re = new RegExp("^" + dojo.regexp.emailAddressList(flags) + "$", "i");
|
|
|
29 |
return re.test(value);
|
|
|
30 |
};
|
|
|
31 |
dojo.validate.getEmailAddressList = function (value, flags) {
|
|
|
32 |
if (!flags) {
|
|
|
33 |
flags = {};
|
|
|
34 |
}
|
|
|
35 |
if (!flags.listSeparator) {
|
|
|
36 |
flags.listSeparator = "\\s;,";
|
|
|
37 |
}
|
|
|
38 |
if (dojo.validate.isEmailAddressList(value, flags)) {
|
|
|
39 |
return value.split(new RegExp("\\s*[" + flags.listSeparator + "]\\s*"));
|
|
|
40 |
}
|
|
|
41 |
return [];
|
|
|
42 |
};
|
|
|
43 |
|