var richCKEditor = CKEDITOR.instances["#{id:inputRichText1}"]; // Need to test for 2 possible strings if the RTF is empty // RegEx tests the initial empty value var RegEx = /<.+?><.+?>.{5}<.+?><.+?>/; // RegEx2 test for an empty value if RTF had some text that was removed var RegEx2 =/<.+?>.{6}<.+?>/; var BodyText = richCKEditor.getData(); // Uncomment to see the character string and length to test for // XSP.alert("Text: " + BodyText + " Length: " + BodyText.length); // Need to test the length so that we do not indicate an error even if something was entered if((RegEx.test(BodyText) || RegEx2.test(BodyText)) && BodyText.length < 81){ XSP.alert("Please enter some text"); return false; }