checking multiple controls on the client-side?

10 posts, 0 answers
  1. Lion
    Lion avatar
    23 posts
    Member since:
    Aug 2012

    Posted 12 Jan 2010 Link to this post

    Hi, 
    Can someone please tell me how to spell check multiple controls on the client-side? It seems that there used be a demo on the website, but I guess it was replaced when server-side ControlIdSToCheck got implemented.

    I would like to spell check a few pre existing textbox/textareas and also few textboxes that were created dynamically via js on the client-side, all by clicking on a single "Spell check" button.
     
    Thanks a lot!!
    Kate 
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 13 Jan 2010 Link to this post

    Hi Kate,

    Please, see the following help article on the subject: Spellchecking Multiple Text Areas.

    Kind regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lion
    Lion avatar
    23 posts
    Member since:
    Aug 2012

    Posted 13 Jan 2010 Link to this post

    That worked. Thanks!!
  5. Lion
    Lion avatar
    23 posts
    Member since:
    Aug 2012

    Posted 19 Jan 2010 Link to this post

    Hey, sorry I have to reopen this issue...
    The solution works perfectly except for the fact that texts from all of the textbox will show up at the same time on the popup. It is a bit confusing because you don't know which textbox you are spellchecking currently. Is there any remedy for this?

    Thanks!
    Kate
  6. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 20 Jan 2010 Link to this post

    Hi Kate,

    You should implement a custom text source for RadSpell along with <hr> control separators:

    <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><hr/></controlSeparator>");
             }
             this.set_text = function(text)
             {
                var texts = text.split("<controlSeparator><hr/></controlSeparator>");
                for (var i = 0; i < this.sources.length; i++)
                {
                   this.sources[i].set_text(texts[i]);
                }
             }
           }
           function spellCheck()
           {   
               var sources =
                   [
                   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>  
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
    <telerik:RadSpell ID="RadSpell1" runat="server" ButtonType="None" />
    <input id="Button1" type="button" value="Spell Check All" onclick="spellCheck();" />

    The solution is based on this help article: Spellchecking Multiple Text Areas.

    Sincerely,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Lion
    Lion avatar
    23 posts
    Member since:
    Aug 2012

    Posted 20 Jan 2010 Link to this post

    Thanks, that looks much better. It looks like I can put any tags inbetween controlSeparators. Maybe I can put the label for each textbox as well, to distinguish one from the other.
    Kate
  8. Lion
    Lion avatar
    23 posts
    Member since:
    Aug 2012

    Posted 22 Feb 2010 Link to this post

    So, per my previous post, I just tried to insert a label for each field I am checking (see code below, between controlSeparator).  However, this doesn't seem to work :( Basically I am trying to put a label of the textbox next to each <HR/>, so user can see from which textbox the misspelled text came from. We are checking many textbox with one spellcheck link, so it would be helpful to see a label. Is such technique supported? 
    Thanks!
    Kate

          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>Label of the textbox<hr/></controlSeparator>");
             }
             this.set_text = function(text)
             {
                var texts = text.split("<controlSeparator>Label of the textbox<hr/></controlSeparator>");
                for (var i = 0; i < this.sources.length; i++)
                {
                   this.sources[i].set_text(texts[i]);
                }
             }
           }
  9. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 25 Feb 2010 Link to this post

    Hi Kate,

    The requested feature is not supported out-of-the box by RadSpell. If you add text inside the <controlSeparator> tags then this text will be also spell checked by RadSpell and included in all textboxes when the spellchecking finished.

    I logged your request in our ToDo list and we will consider its implementation. I also updated your Telerik points for your feature request.


    Greetings,
    Rumen
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. Lion
    Lion avatar
    23 posts
    Member since:
    Aug 2012

    Posted 13 Apr 2010 Link to this post

    Hi,
    we found a problem with the client-side spell checking--

    When we try to spell cheeck text from multple controls, and if the last word of one control is same as the first word of the next control, Spell Checker will catch that as a duplicate text. For example: 
    I had a dog<controlSeparator><hr/></controlSeparator>dog was a good pet.
    In this case, "dog" is flagged as a duplicate word.

    Is there a workaround on this?
    Thanks a lot!
    Kate
  11. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 15 Apr 2010 Link to this post

    Hi Kate U,

    The textsource functionality of RadSpell works with a single string only (the content of the different textboxes is united in a single string) so it is not possible to spell check the content of each single control separately.

    What you can do is to complete disable the check for repeated words by setting the WordIgnoreOptions property to "RepeatedWords". See this help article for more information: Ignoring Words and Fragments.

    All the best,
    Rumen
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017