helloIAmPau helloIAmPau - 11 months ago 184
Javascript Question

bootstrapvalidator gives "Cannot read property 'group' of undefined" on ckeditor field

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

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

skin: 'moono,/asset/css/moono/',
language: 'it',
toolbarGroups: [
removeButtons: 'Strike,SpecialChar,Anchor',
extraPlugins: 'youtube'
}).editor.on('change', function() {
.bootstrapValidator('updateStatus', 'text', 'NOT_VALIDATED')
.bootstrapValidator('validateField', 'text');

declaring it in my html in this way

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

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

Uncaught TypeError: Cannot read property 'group' of undefined

and the field is not validated.

Thanks for your help

Raj Raj
Answer Source

The below works good,

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


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