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:
$('#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');
});
declaring it in my html in this way
<form id="posteditor">
....
<textarea class="form-control" name="text" id="text"></textarea>
....
</form>
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
The below works good,
$('#posteditor')
.bootstrapValidator('updateStatus', $('#text'), 'NOT_VALIDATED')
.bootstrapValidator('validateField', $('#text'));
});
Or
$('#posteditor').bootstrapValidator('revalidateField', $('#text'));