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

spell check does not work from javascript

2 Answers 80 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Joel R
Top achievements
Rank 1
Joel R asked on 19 Oct 2009, 05:41 PM
I have tried the example for starting spell check from javascript but it is not working for me.  The spell check windows opens and then immediately closes.  If I set buttonType="PushButton" and then click on the spell check button the spell check works as desired.

I used a good Telerik sample but cannot find the exact reference that I used but the link below is basically what I used
http://www.telerik.com/help/aspnet-ajax/spell_howtolaunching.html

Below is a non working sample.  I am using Telerik version 2009.2.826.35

Any help is greatly appreciated.

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="QuestionNote.aspx.vb" Inherits="QuestionNote" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>Question Note</title> 
</head> 
<body> 
 
    <script type="text/javascript">  
        function spellCheck()  
        {  
            var spell = $find("<%= RadSpell1.ClientID %>");  
            spell.startSpellCheck();  
        }  
 
        function checkFinished (sender, args)  
        {  
            args.suppressCompleteMessage = true;  
            alert('finished');  
        }  
    </script> 
 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
    <table width='100%' cellpadding='2'>  
        <tr> 
            <td> 
                <asp:TextBox ID="tbxNote" runat="server" Width="100%" Height="100" TextMode="MultiLine" Text='asdf' 
                    Rows="4"></asp:TextBox> 
                <br> 
            </td> 
        </tr> 
        <tr> 
            <td align='center'>  
                <input type="submit" name="Save" value="Save" class="ButtonNormal" onclick="return spellCheck()" /> 
                <asp:Button ID="btnCancel" runat="server" CssClass="ButtonNormal" Text="Cancel" /> 
            </td> 
        </tr> 
    </table> 
    <input id="control" type="hidden" name="control" runat="server">  
    <telerik:RadSpell ID="RadSpell1" runat="server" 
        ButtonType="None" ControlToCheck="tbxNote" OnClientCheckFinished="checkFinished" /> 
    </form> 
</body> 
</html> 
 

 

 

 

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 20 Oct 2009, 07:12 AM
Hello Joel R,

Add the following line to your code and it will work as expected:

function spellCheck()
{
    var spell = $find("<%= RadSpell1.ClientID %>");
    spell.startSpellCheck();
    return false;
}

The reason for the problem is that you are using a submit button to call a JavaScript function. When you click it, the OnClientClick eventhandler is executed, e.g. the RadSpell is shown, but immediately after that the postback, that this submit button invokes, takes place and the page is reloaded. To avoid that you should cancel the postback.

Greetings,
Georgi Tunev
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
Joel R
Top achievements
Rank 1
answered on 21 Oct 2009, 01:40 PM
THANKS
Tags
Spell
Asked by
Joel R
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Joel R
Top achievements
Rank 1
Share this question
or