This commit is contained in:
2019-03-11 23:17:54 +00:00
parent 6550307caa
commit 32dce08fcf
3 changed files with 16 additions and 2 deletions

View File

@@ -11,6 +11,19 @@ import locale from "./locale";
import _ from "../libs/lodash.min.js";
export default {
Required(ltkey, value) {
if (!_.isEmpty(value)) {
return false;
}
//get the localized rule text
// "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
var err = locale.get("ErrorRequiredFieldEmpty");
var fieldName = locale.get(ltkey);
err = _.replace(err, "{0}", fieldName);
//lodash replace only replaces first instance so need to do it twice
err = _.replace(err, "{0}", fieldName);
return err;
},
MaxLength(ltkey, value, max) {
if (value === undefined || value === null) {
return false;