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.CurrencyTextbox");
|
|
|
14 |
dojo.require("dojo.widget.IntegerTextbox");
|
|
|
15 |
dojo.require("dojo.validate.common");
|
|
|
16 |
dojo.widget.defineWidget("dojo.widget.CurrencyTextbox", dojo.widget.IntegerTextbox, {mixInProperties:function (localProperties, frag) {
|
|
|
17 |
dojo.widget.CurrencyTextbox.superclass.mixInProperties.apply(this, arguments);
|
|
|
18 |
if (localProperties.fractional) {
|
|
|
19 |
this.flags.fractional = (localProperties.fractional == "true");
|
|
|
20 |
} else {
|
|
|
21 |
if (localProperties.cents) {
|
|
|
22 |
dojo.deprecated("dojo.widget.IntegerTextbox", "use fractional attr instead of cents", "0.5");
|
|
|
23 |
this.flags.fractional = (localProperties.cents == "true");
|
|
|
24 |
}
|
|
|
25 |
}
|
|
|
26 |
if (localProperties.symbol) {
|
|
|
27 |
this.flags.symbol = localProperties.symbol;
|
|
|
28 |
}
|
|
|
29 |
if (localProperties.min) {
|
|
|
30 |
this.flags.min = parseFloat(localProperties.min);
|
|
|
31 |
}
|
|
|
32 |
if (localProperties.max) {
|
|
|
33 |
this.flags.max = parseFloat(localProperties.max);
|
|
|
34 |
}
|
|
|
35 |
}, isValid:function () {
|
|
|
36 |
return dojo.validate.isCurrency(this.textbox.value, this.flags);
|
|
|
37 |
}, isInRange:function () {
|
|
|
38 |
return dojo.validate.isInRange(this.textbox.value, this.flags);
|
|
|
39 |
}});
|
|
|
40 |
|