This is a migrated thread and some comments may be shown as answers.

Problem with spellcheck

2 Answers 76 Views
Editor
This is a migrated thread and some comments may be shown as answers.
vikram
Top achievements
Rank 1
vikram asked on 07 Nov 2008, 08:46 AM
I have three textboxes and one telerik editor. i am performing the spell check (using client side javascript)for all the three textboxes and editor, but some how i am unable to  perform spell check for editor which is not supporting javascript spell check( i performed  spell check as per example which you given in the demo examples). i am using 2008 version telerik. can u let me know solution for this very urgent.

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 11 Nov 2008, 12:41 PM
Hi Vikram,

Here is the requested solution how to spellcheck three textboxes and one RadEditor on the page with external spellchecker:

    <asp:ScriptManager ID="ScriptManager1" runat="server" />
   
    <telerik:RadEditor ID="RadEditor1" Content="testt" runat="server">
    <Modules>
        <telerik:EditorModule Name="test" Visible="false" />
    </Modules>
    </telerik:RadEditor>
    <asp:TextBox ID="TextBox1" runat="server">behaviour</asp:TextBox>
    <asp:TextBox ID="TextBox2" runat="server">behaviour</asp:TextBox>
    <asp:TextBox ID="TextBox3" runat="server">behaviour</asp:TextBox>
    <telerik:RadSpell ID="RadSpell1" runat="server" ButtonType="None" />
    <input id="Button1" type="button" value="Spell Check All" onclick="spellCheck();" />

       <script type="text/javascript">
       function MultipleTextSource(sources)
       {
        
         this.sources = sources;
         this.get_text = function()
         {
            var texts = [];
            for (var i = 0; i < this.sources.length; i++)
            {
               texts[texts.length] = this.sources[i].get_text();
            }
            return texts.join("<controlSeparator><br/></controlSeparator>");
         }
         this.set_text = function(text)
         {
            var texts = text.split("<controlSeparator><br/></controlSeparator>");
            for (var i = 0; i < this.sources.length; i++)
            {
               this.sources[i].set_text(texts[i]);
            }
         }
       }
       function spellCheck()
       {   
      
           var editorSource = $find('RadEditor1').get_contentAreaElement().contentWindow.document.body;
          
           var sources =
               [
                   new Telerik.Web.UI.Spell.HtmlElementTextSource(editorSource),
                   new Telerik.Web.UI.Spell.HtmlElementTextSource($get('TextBox1')),
                   new Telerik.Web.UI.Spell.HtmlElementTextSource($get('TextBox2')),
                   new Telerik.Web.UI.Spell.HtmlElementTextSource($get('TextBox3'))
               ];
          
           var spell = $find('<%= RadSpell1.ClientID %>');
           spell.set_textSource(new MultipleTextSource(sources));
           spell.startSpellCheck();
       }
       </script>

For your convenience I have attached my test page.

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
vikram
Top achievements
Rank 1
answered on 24 Nov 2008, 11:37 AM
Hello Rumen,

    Thanks for you help. Its working fine.

Thanks & Regards,
Vikram
Tags
Editor
Asked by
vikram
Top achievements
Rank 1
Answers by
Rumen
Telerik team
vikram
Top achievements
Rank 1
Share this question
or