I'm trying to validate the content of the HTML Editor using an ASP.net custom validator control. The idea is to check that some content has been input - the same way a required field validator works.
In the ClientValidationFunction="SomeFunction" I reference this function:
function SomeFunction(source, args)
{
var editor = $find("<%=htmlEditor.ClientID%>");
var content = editor.get_content();
var isValid = content.length > 0;
editor.set_content(content);
args.IsValid = isValid;
}
The reason that I set the content after getting it, is that this is a hack to get the content to re-register in the editor. For some reason, if I don't reset the content on the second attempt to postback - once it's been validated - the empty content, from the first attempt, gets posted back instead of the valid content.
Does anyone know either how to check the content of the HTML Editor, without having to reset the content? Or, if it is reset using set_content(), without the font size and font style menus being de-activated?