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

How to enable and disable spell check on demand

5 Answers 253 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Waseem
Top achievements
Rank 1
Waseem asked on 05 Feb 2013, 03:39 PM
Hi,
I am using RadSpell checker in my applicatioin. In this particular scenario dictionary settings are comming from DB on per user basis. In order to create dictionary settings we have provided a screen where user can upload a custom dictionary, can select a specific custom dictionary etc. Once these settings are defined and saved, application get these setting from DB whenver and wherever required. Till this point everything is perfectly fine but now I have to give the option of Auto Spell Check without making use of RadSpell button. In this case user will define (will be enabled/disabled from setting page) if he/she want to do spell check or not rather having spell check enabled all the time. Could please anyone tell me how I can achieve my desired functionality also how I can do spell check on lost focus without making use of RadSpell button.
Kind Regards,.

5 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 07 Feb 2013, 04:14 PM
Hi,

Here is an example how to fire the spellchecker on blur of a textbox:

<script type="text/javascript">
    function spellCheck() {
        var radtextbox = $find("<%=rtbAccomplishment.ClientID%>");
        setTimeout(function () {
            if (radtextbox.get_value() != "") {
                var spell = $find("<%= RadSpell1.ClientID %>");
                spell.startSpellCheck();
            }
        }, 10);
          
        return false;
    }
</script>
<telerik:RadTextBox ID="rtbAccomplishment" runat="server" onblur="spellCheck();"  ></telerik:RadTextBox>
<telerik:RadSpell   id="RadSpell1" runat="server" ButtonType="None"   ControlsToCheck="rtbAccomplishment"/>


All the best,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Waseem
Top achievements
Rank 1
answered on 08 Feb 2013, 12:29 PM
Thank you Rumen!
I have already done that by defining TextBox 'OnBlur' function. Thanks for your answer.
Now I have a different problem and hope you may provide some work around.

As my RadSpell is completly client side and it fires RadSpell on lost focus on the basis of saved settings (if user has saved a specific dictionary and also if he/she wants to do the auto spell check). Also, User has the option to not to choose auto spell but do it on demand (by clicking the rad spell button). Both scenarios working fine but as I also have a FormIsDirty Java Script function which fires everytime user nevigate awawy without saving changes. So when I click on Spell Check button, FormIsDirty fires and nevigate away dialog pops up before the spell check dialog as changes has been made in text box. I looked into the Rad Spell Client Events but didn't find any, where I can stop firing the navigate away dialog. Could you please tell me if there is any work around or dont you think Telerik should provide some more client side events for Rad Spell (e.g may be something like OnClientClick).
Your help will really be appriciated.
Kind Regards.
0
Accepted
Rumen
Telerik team
answered on 08 Feb 2013, 04:52 PM
Hello,

This KB article could be helpful for this scenario: Enforce Spellchecking On Submit.

All the best,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jhonny
Top achievements
Rank 2
answered on 02 Oct 2015, 03:33 PM

Hi, Rumen.

Is posible to call to method that verify all the text to check, without spell.startSpellCheck()....similar to 

 

//New - throw event
             this.raiseEvent("spellCheckStart");

             //No mistakes found
             if (spellCheckResult.badWords.length == 0) {
                 this.finishSpellCheck();
             }​

0
Marin Bratanov
Telerik team
answered on 06 Oct 2015, 08:27 AM

Hello Jhonny,

RadSpell does not offer such a facility. The logic that handles checking words (sending them to the server and getting suggestions back) is actually in its dialog, not on the main page.

Regards,

Marin Bratanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Spell
Asked by
Waseem
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Waseem
Top achievements
Rank 1
Jhonny
Top achievements
Rank 2
Marin Bratanov
Telerik team
Share this question
or