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.widget.UsTextbox");
|
|
|
14 |
dojo.require("dojo.widget.ValidationTextbox");
|
|
|
15 |
dojo.require("dojo.validate.us");
|
|
|
16 |
dojo.widget.defineWidget("dojo.widget.UsStateTextbox", dojo.widget.ValidationTextbox, {mixInProperties:function (localProperties) {
|
|
|
17 |
dojo.widget.UsStateTextbox.superclass.mixInProperties.apply(this, arguments);
|
|
|
18 |
if (localProperties.allowterritories) {
|
|
|
19 |
this.flags.allowTerritories = (localProperties.allowterritories == "true");
|
|
|
20 |
}
|
|
|
21 |
if (localProperties.allowmilitary) {
|
|
|
22 |
this.flags.allowMilitary = (localProperties.allowmilitary == "true");
|
|
|
23 |
}
|
|
|
24 |
}, isValid:function () {
|
|
|
25 |
return dojo.validate.us.isState(this.textbox.value, this.flags);
|
|
|
26 |
}});
|
|
|
27 |
dojo.widget.defineWidget("dojo.widget.UsZipTextbox", dojo.widget.ValidationTextbox, {isValid:function () {
|
|
|
28 |
return dojo.validate.us.isZipCode(this.textbox.value);
|
|
|
29 |
}});
|
|
|
30 |
dojo.widget.defineWidget("dojo.widget.UsSocialSecurityNumberTextbox", dojo.widget.ValidationTextbox, {isValid:function () {
|
|
|
31 |
return dojo.validate.us.isSocialSecurityNumber(this.textbox.value);
|
|
|
32 |
}});
|
|
|
33 |
dojo.widget.defineWidget("dojo.widget.UsPhoneNumberTextbox", dojo.widget.ValidationTextbox, {isValid:function () {
|
|
|
34 |
return dojo.validate.us.isPhoneNumber(this.textbox.value);
|
|
|
35 |
}});
|
|
|
36 |
|