Home Search Member List Faq Register Login  
UltimateEditor
Re: HasSpellingErrors returns true after errors are corrected

Thread Starter: StraszDevelopment   Started: 02-02-2009 4:03 PM   Replies: 8
 Karamasoft Support Forums » General Discussions » UltimateEditor » Re: HasSpellingErrors returns true after errors are corrected
 Printable Version    « Previous Thread   Next Thread »
  02 Feb 2009, 4:03 PM
StraszDevelopment is not online. Last active: 5/27/2011 6:00:19 AM StraszDevelopment

Top 10 Posts
Joined on 02-05-2008
Posts 8
HasSpellingErrors returns true after errors are corrected
If I type misspelled text, then correct that text with right-click and word selection, the HasSpellingErrors function still returns true when I submit the page.  Is there any way to force a spelling check again on my text without typing new text?



  
  02 Feb 2009, 4:12 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: HasSpellingErrors returns true after errors are corrected
HasSpellingErrors works only before submitting your page. In your page, you can define a form onsubmit event handler that sets the value of a hidden field in your page to the output of the HasSpellingErrors method, then after the postback you can check the value of that hidden field.
  
  03 Feb 2009, 8:18 AM
StraszDevelopment is not online. Last active: 5/27/2011 6:00:19 AM StraszDevelopment

Top 10 Posts
Joined on 02-05-2008
Posts 8
Re: HasSpellingErrors returns true after errors are corrected
Thank you for the reply, but I don't think this answered my specific question.  I will try to provide more details. 

First, I have a TextBox control on my page that is checked by the UltimateSpell control:

<asp:TextBox ID="txtField" runat="server" Width="200px" TabIndex="1" Style="position: relative;z-index:1" MaxLength="100"></asp:TextBox>

<cc1:UltimateSpell ID="ctlSpellChecker" runat="server"     AutoCorrect="True" EnableViewState="true"
  ControlIdsToCheck="txtField"
  IgnoreWordsInUpperCase="False" ShowModal="True" ShowOptions="True" ShowSpellButton="False"
  SpellAsYouType="True" CustomDictionary="MyCustomDictionary">
<MisspelledWordStyle Font-Bold="True" ForeColor="#FF0000"></MisspelledWordStyle>
<SpellButton ButtonType="Button" Text="Spell Check" CausesValidation="True" ImageUrl=""
ImageAlign="AbsMiddle"></SpellButton>
</cc1:UltimateSpell>

I have a javascript function that is called when a button is selected to submit the page:

function spellChecker()
{
    var bHasSpellingErrors = false;

    for (var oKey in UltimateSpellAsYouTypes)
    {
        if (UltimateSpellAsYouTypes[oKey].HasSpellingErrors() == true)
        {
            bHasSpellingErrors = true;
            break;
        }
    }
  
    if (bHasSpellingErrors)
    {
        if (window.confirm('There are spelling errors on this page. Would you still like to continue?') == true)
            return true;
        else
            return false;
    }
    else
        return true;
}


This function is called on a button click event:
btnSubmit.Attributes.Add("onclick", return spellChecker();");

If I only type text in the control checked by UltimateSpell, the function HasSpellingErrors() works correctly.  However, if I right-click and use the suggested words to correct my spelling mistakes, the HasSpellingErrors() function does not update its value, and remains true even when the text shows no spelling errors.

Thanks for any help.

  
  04 Feb 2009, 12:06 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: HasSpellingErrors returns true after errors are corrected
We tried your code in our test environment and it doesn't generate the issue you mention. HasSpellingErrors method return false if all the spelling errors are corercted with right-click and replacing with the suggested word. Are you using the latest version?
  
  04 Feb 2009, 1:58 PM
StraszDevelopment is not online. Last active: 5/27/2011 6:00:19 AM StraszDevelopment

Top 10 Posts
Joined on 02-05-2008
Posts 8
Re: HasSpellingErrors returns true after errors are corrected
 Karamasoft wrote:
We tried your code in our test environment and it doesn't generate the issue you mention. HasSpellingErrors method return false if all the spelling errors are corercted with right-click and replacing with the suggested word. Are you using the latest version?


UltimateEditor version: 3.1.3127.26343
UltimateSpell version: 3.1.3127.26304

Are these the latest?

  
  04 Feb 2009, 2:02 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: HasSpellingErrors returns true after errors are corrected
Both products are upgraded to version 3.3.
  
  04 Feb 2009, 4:29 PM
StraszDevelopment is not online. Last active: 5/27/2011 6:00:19 AM StraszDevelopment

Top 10 Posts
Joined on 02-05-2008
Posts 8
Re: HasSpellingErrors returns true after errors are corrected
 Karamasoft wrote:
Both products are upgraded to version 3.3.


Thanks, I'll get the latest and test.

  
  10 Feb 2009, 9:53 AM
StraszDevelopment is not online. Last active: 5/27/2011 6:00:19 AM StraszDevelopment

Top 10 Posts
Joined on 02-05-2008
Posts 8
Re: HasSpellingErrors returns true after errors are corrected
After downloading and installing the latest version of Ultimate Editor and Ultimate Spell, I created a new test web application.  I added version 3.3 of UE and US to the web References, and copied the include directory to the project.

I created one page that has a text box control and a submit button only.  Here is the source of the page:


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWeb._Default" %>
<%@ Register Assembly="UltimateSpell" Namespace="Karamasoft.WebControls.UltimateSpell"
    TagPrefix="cc1" %>

<!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 runat="server">
    <title>Untitled Page</title>
    <script language="javascript" type="text/javascript">
        function spellChecker()
        {
            var bHasSpellingErrors = false;

            for (var oKey in UltimateSpellAsYouTypes)
            {
                if (UltimateSpellAsYouTypes[oKey].HasSpellingErrors() == true)
                {
                    bHasSpellingErrors = true;
                    break;
                }
            }
          
            if (bHasSpellingErrors)
            {
                if (window.confirm('There are spelling errors on this page. Would you still like to continue?') == true)
                    return true;
                else
                    return false;
            }
            else
                return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtField" runat="server" Width="200px" TabIndex="1" Style="position: relative;z-index:1" MaxLength="100"></asp:TextBox>
        
        <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
            onclick="btnSubmit_Click" />

        <cc1:UltimateSpell ID="ctlSpellChecker" runat="server"     AutoCorrect="True" EnableViewState="true"
          ControlIdsToCheck="txtField"
          IgnoreWordsInUpperCase="False" ShowModal="True" ShowOptions="True" ShowSpellButton="False"
          SpellAsYouType="True" CustomDictionary="MyCustomDictionary">
        <MisspelledWordStyle Font-Bold="True" ForeColor="#FF0000"></MisspelledWordStyle>
        <SpellButton ButtonType="Button" Text="Spell Check" CausesValidation="True" ImageUrl=""
        ImageAlign="AbsMiddle"></SpellButton>
        </cc1:UltimateSpell>    
    </div>
    </form>
</body>
</html>


Here is the code behind:


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace TestWeb
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            btnSubmit.Attributes.Add("onclick", "return spellChecker();");
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {

        }
    }
}



When I run the page, I type  som baad text in the text box, then right click on som and select sum from the list.  Then I right-click on baad and select bad from the list.  Then I click the Submit button to fire the javascript.  At this point HasSpellingErrors returns true.  If I look at the text in the debugger using the GetSpellText() method, the text contains the corrected words.

Therefore, this problem still exists in the latest version.


  
  10 Feb 2009, 9:51 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: HasSpellingErrors returns true after errors are corrected
We fixed this issue. We haven't published a new release but will send you the patch shortly.
  
 Page 1 of 1 (9 items)
Karamasoft Support Forums » General Discussions » UltimateEditor » Re: HasSpellingErrors returns true after errors are corrected

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2019 Karamasoft LLC. All rights reserved.