]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * Validates that the the value is between a {@link #min} and {@link #max}.\r | |
3 | */\r | |
4 | Ext.define('Ext.data.validator.Range', {\r | |
5 | extend: 'Ext.data.validator.Bound',\r | |
6 | alias: 'data.validator.range',\r | |
7 | \r | |
8 | type: 'range',\r | |
9 | \r | |
10 | config: {\r | |
11 | /**\r | |
12 | * @cfg {Number} min\r | |
13 | * The minimum value.\r | |
14 | */\r | |
15 | \r | |
16 | /**\r | |
17 | * @cfg {Number} max\r | |
18 | * The maximum value.\r | |
19 | */\r | |
20 | \r | |
21 | /**\r | |
22 | * @inheritdoc\r | |
23 | */\r | |
24 | minOnlyMessage: 'Must be must be at least {0}',\r | |
25 | \r | |
26 | /**\r | |
27 | * @inheritdoc\r | |
28 | */\r | |
29 | maxOnlyMessage: 'Must be no more than than {0}',\r | |
30 | \r | |
31 | /**\r | |
32 | * @inheritdoc\r | |
33 | */\r | |
34 | bothMessage: 'Must be between {0} and {1}',\r | |
35 | \r | |
36 | /**\r | |
37 | * @cfg {String} nanMessage\r | |
38 | * The error message to return when the value is not numeric.\r | |
39 | */\r | |
40 | nanMessage: 'Must be numeric'\r | |
41 | },\r | |
42 | \r | |
43 | validateValue: function(value) {\r | |
44 | var msg = this.callParent([value]);\r | |
45 | if (msg === true && isNaN(value)) {\r | |
46 | msg = this.getNanMessage();\r | |
47 | }\r | |
48 | return msg;\r | |
49 | }\r | |
50 | });\r |