I have faced lot of problem in validating a rich text box in SharePoint through JavaScript. Problem is that it does not recognize the text present in the rich text box.
Here is the solution for validating the rich text box.
function validateComments()
{
//debugger;
var Comment = getTagFromIdentifierAndTitle('textarea','TextField','Comment');
var docEditor=RTE_GetEditorDocument(Comment.id);
if (null==docEditor)
return;
strHtml=docEditor.body.innerHTML;
//alert(strHtml);
if(strHtml !="" && strHtml !="")
{
return true;
}
else
{
alert('Please enter your comment in the box above');
return false;
}
return true;
}
Subscribe to:
Post Comments (Atom)
This is great info. I have a question regarding the validation of cross fields. I would like to have a drop down validation where user selects A, then comment field must flag as required. If user selects B, then comment field is not requried.
ReplyDeleteCan you help?
customize text into section in rich text box
ReplyDelete