New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Error Thrown when in Spell Check mode and Page is Submitted
Problem
RadEditor throws Object doesn't support property or method 'get_commandName' when executing a command while in spell check mode. This can happen if you clean up content in the OnClientSubmit event, for example.
Solution
Ensure spellchecking is finished before executing the command.
To cancel the spell check, you can call either the finishSpellCheck or cancelSpellCheck method of the spell check object that you can get via the get_ajaxSpellCheck method of the RadEditor.
For example:
ASP.NET
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientSubmit="OnClientSubmit">
<Tools>
<telerik:EditorToolGroup>
<telerik:EditorTool Name="AjaxSpellCheck" />
</telerik:EditorToolGroup>
</Tools>
<Content>
miztake
<ol>
<li>start spell checking</li>
<li>click the postback button before existing the spell check mode</li>
</ol>
</Content>
</telerik:RadEditor>
<asp:Button ID="Button1" Text="postback" runat="server" />
<script>
function OnClientSubmit(editor) {
if (editor.get_ajaxSpellCheck()) {
editor.get_ajaxSpellCheck().finishSpellCheck(false);
}
editor.fire("FormatStripper", { value: "WORD_ALL" });
}
</script>