setValidation(callback)
Name | Type | Description |
---|---|---|
callback | function | Function that handles field value validation |
Usage:
// register a custom validation function for this editor
sdk.setValidation(function validateValue(value) {
// sample validation function that
// validates whether entered number of characters is more than 100
var isValid = true;
if (value && value.length > 100) {
isValid = false;
return {
isValid: false,
title: 'Invalid value',
message: 'You have entered more than 100 characters'
};
}
return isValid;
});