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

Text in <STRONG> Tag turns RED

2 Answers 79 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 22 Oct 2008, 01:48 AM
Hi, just wanted to mention that RADSpell is pretty sweet. It's flexible enough to work throughout my applications.

I am using RADspell to sepll check HTML within a DIV tag.
For some reason when RADSpell encounters a strong tag (e.g. <strong>hello</strong>) it turns the text red and underlines it. I noticed that the same behaviour does not occur on B tags.

Is there a work around for this issue (other than switching STRONG to B tag)?

Thank You

2 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 23 Oct 2008, 02:02 PM
Hi Victor,

Please use the following approach to change the text's decoration:
<script type="text/javascript">  
    function OnClientCheckStarted(sender, args)  
    {  
        window.setTimeout(function(){  
            var framedoc = window.frames["RadSpell1dialogOpenerSpellCheckDialog"].document;  
            var textbox = framedoc.getElementById("dialogControl_TextContainer");  
            var elmts = textbox.getElementsByTagName('strong');  
            for(var i =0; i<elmts.length; i++)  
            {  
                var elemStyle = elmts[i].style;   
                elemStyle.color = "black" ;  
                elemStyle.textDecoration = "none";  
                elemStyle.fontWeight = "normal";  
            }  
        },700);                     
    }  
</script>  
<asp:TextBox ID="txt1" runat="server"><strong>Some contnett</strong></asp:TextBox>  
<telerik:RadSpell OnClientCheckStarted="OnClientCheckStarted" ID="RadSpell1" runat="server" ControlToCheck="txt1" /> 

I hope this helps.

Kind regards,
George
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Victor
Top achievements
Rank 1
answered on 23 Oct 2008, 09:17 PM

Thanks for the code.
I found another way of doing it:
Define a custom text source and replace all <strong> tags with <b> tags.
Once the spell checker is complete you can convert everything back to <strong> tab.
I tested this code on FireFox 3 and IE 7.

this.get_text = function() {  
 return anObject.innerHTML.replace(/<strong/gi,'<b').replace(/<\/strong/gi,'</b');  
}          
this.set_text = function(text) {  
    anObject.innerHTML=text.replace(/<b/gi,'<strong').replace(/<\/b/gi,'</strong');  
Tags
Spell
Asked by
Victor
Top achievements
Rank 1
Answers by
George
Telerik team
Victor
Top achievements
Rank 1
Share this question
or