I would like to validate CKEDITOR after loading it in textarea having id="txtNews" and it has name="news". I want to use validate.js for validating ckeditor. If ckeditor is blank and if i click 'Save' button then ckeditor should be marked as '*' red color. and should not proceed further.
I try to validate for other fields including textarea and so on but when i load CKEDITOR to textarea and used it's name attribute to validate using rules and message as object passing to validate() function as parameter then only textarea having CKEDITOR is not validate.
Note: i only want to validate using validate.js and name attribute must be used for validating.
Can someone provide me answer ?
This image will help, what i have the problem.
HTML code is below:
<div class="frmlabel">
<label class="sfFormlabel">
NewsTitle</label>
</div>
<div class="inputclass">
<textarea id="txtNewsTitle" name="newstitle" class="sfTextarea"></textarea>
</div>
</div>
<div class="fieldwrapper">
<div class="frmlabel">
<label class="sfFormlabel">
Searach Key</label>
</div>
<div class="inputclass">
<textarea id="txtNewsSearchKey" name="search" class="sfTextarea"></textarea>
</div>
</div>
<div class="fieldwrapper">
<div class="frmlabel">
<label class="sfFormlabel">
News</label>
</div>
<div class="inputclass">
<textarea id="txtNews" name="news" class="sfTextarea"></textarea>
</div>
</div>
<div class="sfButtonwrapper">
<button type="button" id="btnSaveNews" class="sfBtn">
Save</button>
<button id="btnCancelNews" class="sfBtn">
Cancel</button>
</div>
and JS code
delete CKEDITOR.instances['txtNews'];
$("#txtNews").ckeditor();
$('#btnSaveNews').bind('click', function() {
var v = $("#form1").validate({
ignore: ':hidden',
messages: {
newstitle: {
required: '*'
},
search: {
required: '*'
},
news: {
required: '*'
},
date: {
required: '*'
}
},
rules: {
newstitle: {
required: true
},
search: {
required: true
},
news: {
required: true,
news:true
},
date: {
required: true
}
}
});
if (v.form()) {
News.SaveNews();
return false;
}
});