Question

Validation

Hi All,

Is it possible to use setValidationConfig for two separate field on an edit page. Here is my code

setValidationConfig: function() {

this.callParent(arguments);

this.addColumnValidator("AtsLinkedProduct", this.relatedProductValidator);

this.addColumnValidator("AtsLata", this.relatedProductValidator);

},

 

relatedProductValidator: function(value) {

var invalidMessage = "";

var isValid = true;

var currentProduct = this.get("AtsLinkedProduct");

var currentLata = this.get("AtsLata");

var currentZone = this.get("AtsZone");

if (currentProduct && this.get("Products")) {

isValid = !(this.get("Products").indexOf(currentProduct.value) >= 0);

}

if (currentLata && this.get("Products.AtsLATA")) {

isValid = this.get("Products.AtsLATA") !== (currentLata.value);

}

if (!isValid) {

invalidMessage = this.get("Resources.Strings.RelatedProductExists");

}

return {

fullInvalidMessage: invalidMessage,

invalidMessage: invalidMessage

};

},

File attachments

Like

0 comments
Show all comments