機械翻訳について

setValidation(callback)

名前 タイプ 説明
callback 関数 フィールド値の検証を処理する関数

使用状況:

  // 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;
    });