root / trunk / web / dojo / dojox / validate / web.js
History | View | Annotate | Download (1.13 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.validate.web"]){ |
||
9 | dojo._hasResource["dojox.validate.web"]=true; |
||
10 | dojo.provide("dojox.validate.web");
|
||
11 | dojo.require("dojox.validate._base");
|
||
12 | dojox.validate.isIpAddress=function(_1,_2){ |
||
13 | var re=new RegExp("^"+dojox.validate.regexp.ipAddress(_2)+"$","i"); |
||
14 | return re.test(_1);
|
||
15 | }; |
||
16 | dojox.validate.isUrl=function(_3,_4){ |
||
17 | var re=new RegExp("^"+dojox.validate.regexp.url(_4)+"$","i"); |
||
18 | return re.test(_3);
|
||
19 | }; |
||
20 | dojox.validate.isEmailAddress=function(_5,_6){ |
||
21 | var re=new RegExp("^"+dojox.validate.regexp.emailAddress(_6)+"$","i"); |
||
22 | return re.test(_5);
|
||
23 | }; |
||
24 | dojox.validate.isEmailAddressList=function(_7,_8){ |
||
25 | var re=new RegExp("^"+dojox.validate.regexp.emailAddressList(_8)+"$","i"); |
||
26 | return re.test(_7);
|
||
27 | }; |
||
28 | dojox.validate.getEmailAddressList=function(_9,_a){ |
||
29 | if(!_a){
|
||
30 | _a={}; |
||
31 | } |
||
32 | if(!_a.listSeparator){
|
||
33 | _a.listSeparator="\\s;,";
|
||
34 | } |
||
35 | if(dojox.validate.isEmailAddressList(_9,_a)){
|
||
36 | return _9.split(new RegExp("\\s*["+_a.listSeparator+"]\\s*")); |
||
37 | } |
||
38 | return [];
|
||
39 | }; |
||
40 | } |