Community & Support
Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Spell > Needs spell check in loop
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Needs spell check in loop

Feed from this thread
  • Amit avatar

    Posted on Nov 19, 2008 (permalink)

    My current scenario for spell check is, i want to use the SpellCheck method inside a loop and for each item in loop i want to check whether it has got any spelling mistakes or not. result if i try to do this is that it only takes the last item in the loop and displays the spelling check message. Here is the code below that i am trying.

    var Texttocheck ='This is a Test';
     var spellservice = window["SpellCheckService1"]; for(var i = 5; i > 0; i--) { spellservice.SpellCheck(Texttocheck + i, function (sender, args) { alert(sender); if (args && args.BadWords && args.BadWords.length > 0) { alert('Mistake'+i); } else { alert('Fine'); } } ); }

  • Lini Lini admin's avatar

    Posted on Nov 24, 2008 (permalink)

    Hello Amit,

    Each spell check request is asynchronous. This means that your JavaScript loop will not wait until the previous request is finished before going on to the next.

    I changed your code to allow the spell check requests to be queued:

    var Texttocheck ='This is a Test'
    var spellservice = window["SpellCheckService1"];  
    function check(i) 
        if (i<0) 
            return
        spellservice.SpellCheck(Texttocheck + i,  
                function (sender, args) {  
                    if (args && args.BadWords && args.BadWords.length > 0)  
                        alert('Mistake'+i); 
                    else  
                        alert('Fine'); 
                    window.setTimeout( function() {check(i-1);}, 0); 
                } 
        ); 
    function test() 
        check(5); 
     


    Regards,
    Lini
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

  • Amit avatar

    Posted on Nov 24, 2008 (permalink)

    Thanks a lot for your reply, it solved my problem..

    Can you please confirm, whether RAD Controls are IE version specific, Is it possible that some RAD control functionality is working in IE6 and some is not working in IE8?

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Spell > Needs spell check in loop