bootstrapvalidator给出“无法读取未定义的属性"组".在ckeditor字段上 [英] bootstrapvalidator gives "Cannot read property 'group' of undefined" on ckeditor field

查看:376
本文介绍了bootstrapvalidator给出“无法读取未定义的属性"组".在ckeditor字段上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文本区域上使用了ckeditor,我需要设置自定义验证.

I'm using ckeditor on a text area and I need to set a custom validation.

在此示例之后,我以这种方式使用jquery适配器设置文本框:

Following the example, I set the textbox using the jquery adapter in this way:

$('#posteditor')
    .bootstrapValidator()
      .find('[name="text"]').ckeditor({
        skin: 'moono,/asset/css/moono/',
        language: 'it',
        toolbarGroups: [
          {"name":"basicstyles","groups":["basicstyles"]},
          {"name":"paragraph","groups":["list","align"]},
          {"name":"insert","groups":["insert"]},
          {"name":"styles","groups":["styles"]},
          {"name":"links","groups":["links"]},
        ],
        removeButtons: 'Strike,SpecialChar,Anchor',
        extraPlugins: 'youtube'
      }).editor.on('change', function() {
        $('#posteditor')
          .bootstrapValidator('updateStatus', 'text', 'NOT_VALIDATED')
          .bootstrapValidator('validateField', 'text');
      });

以这种方式在我的html中声明

declaring it in my html in this way

<form id="posteditor">
....
  <textarea class="form-control" name="text" id="text"></textarea>
....
</form>

在触发onchange事件时,javascript控制台会显示消息

when the onchange event is fired, the javascript console shows the message

Uncaught TypeError: Cannot read property 'group' of undefined

并且该字段未经验证.

感谢您的帮助

推荐答案

下面的方法效果很好,

$('#posteditor')
      .bootstrapValidator('updateStatus', $('#text'), 'NOT_VALIDATED')
      .bootstrapValidator('validateField', $('#text'));
  });

 $('#posteditor').bootstrapValidator('revalidateField', $('#text'));

这篇关于bootstrapvalidator给出“无法读取未定义的属性"组".在ckeditor字段上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆