Changeset 1411
- Timestamp:
- 14/12/09 13:21:27 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-validators.js
r1361 r1411 38 38 39 39 if (value.constructor != Number || isNaN(value)) 40 return this.notifyFail(" Not a number.");40 return this.notifyFail("i18n:Not a number."); 41 41 42 42 var intValueStr = value.toFixed(0); … … 44 44 45 45 if (intValueStr != valueStr) 46 return this.notifyFail(" Not a valid integer!");46 return this.notifyFail("i18n:Not a valid integer!"); 47 47 48 48 return this.notifySuccess(); … … 53 53 validate : function( value) { 54 54 55 if ($.isEmpty(value)) 56 return this.notifyFail("Field is required!"); 55 if ($.isEmpty(value)) { 56 return this.notifyFail("i18n:Field is required!"); 57 } 57 58 58 59 return this.notifySuccess(); … … 69 70 if (((this.min != undefined) && value < this.min) || ((this.max != undefined) && value > this.max) 70 71 || ((this.step != undefined) && ((value - ((this.min != undefined) ? this.min : 0)) % this.step != 0))) 71 return this.notifyFail(" Should be at least {0}, at most {1}, and in steps of {2}!", [ this.min, this.max,72 return this.notifyFail("i18n:Should be at least {0}, at most {1}, and in steps of {2}!", [ this.min, this.max, 72 73 this.step ]); 73 74 … … 84 85 85 86 if (((this.min != undefined) && value.length < this.min) || (this.max && value.length > this.max)) 86 return this.notifyFail(" Should be longer than {0} and shorter than {1} characters!", [ this.min, this.max ]);87 return this.notifyFail("i18n:Should be longer than {0} and shorter than {1} characters!", [ this.min, this.max ]); 87 88 88 89 return this.notifySuccess(); … … 99 100 100 101 if (this.regex.test(value) != true) 101 return this.notifyFail(" Not a valid value according to the regex ({0}).", [ this.regex ]);102 return this.notifyFail("i18n:Not a valid value according to the regex ({0}).", [ this.regex ]); 102 103 103 104 return this.notifySuccess(); … … 120 121 121 122 if (EMAIL_REGEX.test(value) != true) 122 return this.notifyFail(" Not a valid email adress");123 return this.notifyFail("i18n:Not a valid email adress"); 123 124 124 125 return this.notifySuccess(); … … 133 134 134 135 if (URI_REGEX.test(value) != true) 135 return this.notifyFail(" Not a valid url");136 return this.notifyFail("i18n:Not a valid url"); 136 137 137 138 return this.notifySuccess(); … … 147 148 var options = data.options || []; 148 149 if ($.valueInArray(value, options) < 0) 149 return this.notifyFail(" Value[{0}](@pos {1}) not in list of available options.", [ value, data.index ]);150 return this.notifyFail("i18n:Value[{0}](@pos {1}) not in list of available options.", [ value, data.index ]); 150 151 151 152 return this.notifySuccess(); … … 175 176 result = me.notifyFail(response.message, response.args); 176 177 else 177 result = me.notifyFail(" Remote validation returned incompatible response!");178 result = me.notifyFail("i18n:Remote validation returned incompatible response!"); 178 179 return result; 179 180 }; 180 181 var errorHandler = function() { 181 182 182 result = me.notifyFail(" Error while connecting to remote validation.");183 result = me.notifyFail("i18n:Error while connecting to remote validation."); 183 184 return result; 184 185 };
