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

Spell Check not changing text after spell complete?

3 Answers 58 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 02 May 2011, 08:16 PM
In both IE and FF...I have 3 text boxes, all 3 with misspelled words. I am using a button to trigger the spell check...the spell check dialog pops up and suggests correct words...I hit 'change'...then it says 'The Spell Check is complete!'...when I click 'OK' the text in the textboxes has not changed. While the code shows the textboxes as enabled=false, they are enabled=true at the time of spellcheck.

<script type="text/javascript">
        function spellCheck() {
            var spell = $find('<%= splContractSpellCheck.ClientID %>');
            spell.startSpellCheck();
        }
</script>
  
<asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck()" />
  
<telerik:RadSpell ID="splContractSpellCheck" runat="server" ControlsToCheck="txtContractSummary,txtContractPurpose,txtContractComments"                                 ButtonType="None" />
  
<asp:TextBox ID="txtContractSummary" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="34px" Enabled="false" />
<asp:TextBox ID="txtContractPurpose" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="86px" Enabled="false" />
<asp:TextBox ID="txtContractComments" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="52px" Enabled="false" />

3 Answers, 1 is accepted

Sort by
0
Adam
Top achievements
Rank 1
answered on 03 May 2011, 04:39 PM
As a follow up, I've also tried a different approach, based on some of what I've seen...it too, doesn't update the text...despite the fact I've verified that set_text is being called and is being passed the correct word.

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <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) {
                alert(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 sources =
                    [
                        new Telerik.Web.UI.Spell.HtmlElementTextSource($get('<%= txtContractSummary.ClientID %>')),
                        new Telerik.Web.UI.Spell.HtmlElementTextSource($get('<%= txtContractPurpose.ClientID %>')),
                        new Telerik.Web.UI.Spell.HtmlElementTextSource($get('<%= txtContractComments.ClientID %>'))
                    ];
                  
                var spell = $find('<%= splContractSpellCheck.ClientID %>');
                spell.set_textSource(new MultipleTextSource(sources));
                spell.startSpellCheck();
            }
        </script>
    </telerik:RadCodeBlock>
  
<asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck();" />
  
<telerik:RadSpell ID="splContractSpellCheck" runat="server" ButtonType="None" />
  
<asp:TextBox ID="txtContractSummary" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="34px" Enabled="false" />
<asp:TextBox ID="txtContractPurpose" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="86px" Enabled="false" />
<asp:TextBox ID="txtContractComments" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="52px" Enabled="false" />
0
Rumen
Telerik team
answered on 06 May 2011, 04:38 AM
Hi Adam,

All you need to do is to put "return false;" in the OnClientClick event of the Asp:Button, e.g.

<asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck();return false;" />


Here is a video demonstrating the solution: http://screencast.com/t/oz4YNTAY1VJ.

Best regards,
Rumen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Adam
Top achievements
Rank 1
answered on 06 May 2011, 03:26 PM
awesome, that worked. Thanks!
Tags
Spell
Asked by
Adam
Top achievements
Rank 1
Answers by
Adam
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or