Force spellchecker to run?

Last post 10-20-2010, 8:49 PM by Kenneth. 6 replies.
Sort Posts: Previous Next
  •  08-30-2010, 11:41 PM 63742

    Force spellchecker to run?

    Hi
     
    Is it possible to force the spell checker to run using a field outside of the editor window?
     
    ie you enter your text and want to save/submit it - but want the spellchecker to come up automatically without having to push the Editor button?
     
    Thanks
     
    Cheryl
  •  08-31-2010, 1:13 AM 63743 in reply to 63742

    Re: Force spellchecker to run?

    Hi cheryll,
     
    Please try the example below.
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5. <html xmlns="http://www.w3.org/1999/xhtml">   
    6. <head id="Head1" runat="server">   
    7.     <title>Untitled Page</title>   
    8. </head>   
    9. <body>   
    10.   
    11.     <script runat="server">   
    12.         protected override void OnLoad(EventArgs e)   
    13.         {   
    14.             editor1.Text = "aaa bbb";   
    15.             base.OnLoad(e);   
    16.         }   
    17.         </script>   
    18.   
    19.     <form id="form1" runat="server">   
    20.         <CE:Editor ID="editor1" runat="server">   
    21.         </CE:Editor>   
    22.         <input type="button" value="Save text" onclick="save()" />   
    23.     </form>   
    24. </body>   
    25. </html>   
    26.   
    27. <script>   
    28. function save()   
    29. {   
    30.     var editor1=document.getElementById("<%= editor1.ClientID %>");   
    31.     editor1.ExecCommand("NetSpell");   
    32. }   
    33. </script>  
    Regards,
     
    ken
  •  08-31-2010, 7:14 PM 63765 in reply to 63743

    Re: Force spellchecker to run?

    Thanks for the example Ken
     
    The only problem is that after the Spellchecker window is closed, i then need to invoke a codebehind method.
     
    Any ideas as to how I would do that?
     
    Thanks
     
    Cheryl
  •  08-31-2010, 9:40 PM 63770 in reply to 63765

    Re: Force spellchecker to run?

    hi cheryll,
     
    Try the new example
     
    1. <%@ Page Language="C#" %>   
    2.   
    3. <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>   
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
    5. <html xmlns="http://www.w3.org/1999/xhtml">   
    6. <head id="Head1" runat="server">   
    7.     <title>Untitled Page</title>   
    8. </head>   
    9. <body>   
    10.   
    11.     <script runat="server">      
    12.         protected override void OnLoad(EventArgs e)   
    13.         {   
    14.             editor1.Text = "aaa bbb";   
    15.             base.OnLoad(e);   
    16.         }   
    17.   
    18.         protected void button1_Click(object sender, EventArgs e)   
    19.         {   
    20.             //Execute your codebehind method here   
    21.             label1.Text = "codebehind method achieve";   
    22.         }   
    23.     </script>   
    24.   
    25.     <form id="form1" runat="server">   
    26.         <CE:Editor ID="editor1" runat="server">   
    27.         </CE:Editor>   
    28.         <input type="button" value="Save text" onclick="save()" />   
    29.         <asp:Button ID="button1" runat="server" Style="visibility: hidden" OnClick="button1_Click" />   
    30.         <asp:Label ID="label1" runat="server" ForeColor="red"></asp:Label>   
    31.     </form>   
    32. </body>   
    33. </html>   
    34.   
    35. <script>      
    36. function save()      
    37. {      
    38.     var editor1=document.getElementById("<%= editor1.ClientID %>");      
    39.     var button1=document.getElementById("<%= button1.ClientID %>");      
    40.     editor1.ExecCommand("NetSpell");      
    41.     button1.click();   
    42.        
    43. }      
    44.   
    45. </script>  
    Regards,
     
    ken
  •  08-31-2010, 9:46 PM 63771 in reply to 63770

    Re: Force spellchecker to run?

    Oh dear! looking at your code the answer is SO obvious!
     
    Thanks very much Ken, I'll give it a go.
  •  10-19-2010, 10:42 PM 64515 in reply to 63771

    Re: Force spellchecker to run?

    Hi Ken
     
    I have this solution working quite well thanks very much, however i have noticed that it spell checks any style - is there a way to limit the spellchecker to check only the plaintext?
  •  10-20-2010, 8:49 PM 64541 in reply to 64515

    Re: Force spellchecker to run?

    Hi cheryll,
     
    For now spellcheck does not support this model. Sorry for your inconvenience.
     
    Regards,
     
    Ken 
View as RSS news feed in XML