Hi Team
My Requirement is score must be equal to 0, 17 or 100 to 1000 only
for that process, I am written the code in this way but it is not accepting still 0 & 17 and these condition is working (number>1000) || (number<99)
methods: {
setValidationConfig: function() {
// Calls the initialization of validators for the parent view model.
this.callParent(arguments);
// The phoneValidator() validate method is added to the [Phone] column.
this.addColumnValidator("UsrCRIFScore", this.Scorevalidation);
},
Scorevalidation: function() {
var invalidMessage = "";
var number = this.get("UsrCRIFScore");
if((number !== 0) && (number !== 17) && (number>1000) || (number<99)) {
invalidMessage = this.get("Resources.Strings.crifscorevalidation123");
}
return {
// Validation error message.
invalidMessage: invalidMessage
};
},
},
hoping for positive reply.
regards
manikanta
Like
Dear Manikanta,
Your condition should look like this
If ((number > 1000) || ((number < 99) && (number !== 0) && (number !== 17))) ...
Best regards,
Dennis
Dennis Hudson,
hi Dennis still it's not accepting the 0 and 17
still not accepting 0 and 17
code
methods: {
setValidationConfig: function() {
// Calls the initialization of validators for the parent view model.
this.callParent(arguments);
// The phoneValidator() validate method is added to the [Phone] column.
this.addColumnValidator("UsrPosition", this.Scorevalidation);
},
Scorevalidation: function() {
var invalidMessage = "";
var number = this.get("UsrPosition");
if ((number > 1000) || ((number < 99) && (number !== 0) && (number !== 17))) {
invalidMessage = this.get("Resources.Strings.crifscorevalidation123");
}
return {
// Validation error message.
invalidMessage: invalidMessage
};
},
},
find the attachment below.
manikanta,
This should work:
if ((x !== 0 && x !== 17) && (x > 1000 || x < 100)) {
invalidMessage = this.get("Resources.Strings.crifscorevalidation123");
}
Ryan