This commit is contained in:
@@ -75,6 +75,46 @@ function getControlLabel(ctrl) {
|
||||
}
|
||||
|
||||
export default {
|
||||
///////////////////////////////
|
||||
// SERVER ERRORS
|
||||
//
|
||||
Server(v, ref) {
|
||||
|
||||
|
||||
//check if any errors and short circuit if none
|
||||
|
||||
//check if this control is mentioned at all and short circuit return false if not
|
||||
|
||||
var ctrl = getControl(v, ref);
|
||||
if(typeof ctrl == 'undefined'){
|
||||
return false;
|
||||
}
|
||||
|
||||
//It IS in the list of error controls:
|
||||
|
||||
//check if this control has been changed at all, I guess being here might mean it has?
|
||||
//If this control is dirty / was changed from the value that was in it when the server returned the error then remove the error for this control from the server error list and return false
|
||||
//ELSE if this control is unchanged / not dirty
|
||||
//return the error(s) properly localized
|
||||
|
||||
|
||||
//IF user modifies field in any way then this rule must be cleared
|
||||
|
||||
//Some rules are for the entire object so...???
|
||||
//maybe need a form control that is just about rules or something
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
// // "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}",
|
||||
// var err = locale.get("ErrorRequiredFieldEmpty");
|
||||
// var fieldName = getControlLabel(ctrl);
|
||||
// err = _.replace(err, "{0}", fieldName);
|
||||
// //lodash replace only replaces first instance so need to do it twice
|
||||
// err = _.replace(err, "{0}", fieldName);
|
||||
// return err;
|
||||
},
|
||||
///////////////////////////////
|
||||
// REQUIRED
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user