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

checking multiple controls on the client-side?

9 Answers 83 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Ram
Top achievements
Rank 1
Ram asked on 12 Jan 2010, 07:07 PM
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 

9 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Jan 2010, 08:32 AM
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.
0
Ram
Top achievements
Rank 1
answered on 14 Jan 2010, 12:29 AM
That worked. Thanks!!
0
Ram
Top achievements
Rank 1
answered on 20 Jan 2010, 02:06 AM
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
0
Rumen
Telerik team
answered on 20 Jan 2010, 12:32 PM
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.
0
Ram
Top achievements
Rank 1
answered on 20 Jan 2010, 10:31 PM
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
0
Ram
Top achievements
Rank 1
answered on 22 Feb 2010, 10:11 PM
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]);
            }
         }
       }
0
Rumen
Telerik team
answered on 25 Feb 2010, 10:57 AM
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.
0
Ram
Top achievements
Rank 1
answered on 14 Apr 2010, 12:12 AM
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
0
Rumen
Telerik team
answered on 15 Apr 2010, 04:13 PM
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.
Tags
Spell
Asked by
Ram
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ram
Top achievements
Rank 1
Share this question
or