Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  102] [ 2]  / answers: 1 / hits: 13509  / 10 Years ago, tue, december 23, 2014, 12:00:00

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


More From » jquery

 Answers
1

The below works good,



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


Or



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

[#40442] Monday, December 22, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alvin

Total Points: 55
Total Questions: 101
Total Answers: 109

Location: Sudan
Member since Tue, Aug 3, 2021
3 Years ago
;