Article
How can we use the asyncValidate function from BasePageV2 to verify field population on a page?
Question
How can we use the asyncValidate function from BasePageV2 to verify field population on a page?
Answer
You can view the method implementation in DocumentPageV2. Implement the necessary functionality in a similar way.
Firstly, implement the field population verification method (similar to validateAccountOrContactFilling) that accepts the callback function and execution context as incoming parameters.
Afterwards, call it in asyncValidate.
For example:
asyncValidate: function(callback, scope) { this.callParent([function(response) { if (!this.validateResponse(response)) { return; } Terrasoft.chain( function(next) { this.myValidationMethod(function(response) { if (this.validateResponse(response)) { next(); } }, this); }, function() { callback.call(scope, response); }, this); }, this]); }