Welcome Guest Search | Active Topics | Sign In | Register

How to know if the Spell checker was invoked Options
Luiz Ferreira
Posted: Wednesday, June 3, 2009 3:02:03 PM
Rank: Member
Groups: Member

Joined: 12/4/2008
Posts: 17
Hi,

I have an application where operators take calls and register problems on a text box. I placed a button next to the textbox and linked it to spell checker startbutton property. Everything works fine when the operator clicks on the button. Now I want to register in the log if the operator used the Spell Checker. Well I tried to use the onclick of this button but it does not fire when the operator clicks on it. I also tried to work with the onclick event of the change button on the dialog box. same thing, the onclick event does not fire. Any suggestion?
Thanks
eo_support
Posted: Wednesday, June 3, 2009 3:42:00 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

It is possible to log SpellChecker operations but it takes some extra coding to do that. SpellChecker relies on AJAX so does not post back the page, as such no server side event is raised. As a result, in order to catch and log spell checking event, you must catch it on the client side and then somehow notify your server side code to write the log.

In order to catch the event on the client side, you would need to trigger the SpellChecker’s with JavaScript instead of setting StartButton. It will be something like this:

Code: HTML/ASPX
<input type="button" value="Spell Check" onclick="spellcheck()" />


Here “spellcheck” is your own JavaScript function and you would call our client side JavaScript interface to start the spell checker inside this function. for example, it can be something like this:

Code: JavaScript
function spellcheck()
{
     //report this to the server side….
     …..

     //trigger the spell checker
     eo_GetObject("SpellChecker1").start();
}


This should start the spell checker when you click the button. The next step is to implement the JavaScript code to notify your server side code so that your server side code can log the event. There are many ways to do this. You can make an AJAX call to the same page (see ASP.NET AJAX or our CallbackPanel for more details), or call a separate web service from your code. You can also dynamically create an element that pulls a certain Url from your server, for example:

Code: JavaScript
var img = document.createElement("IMG");
document.body.appendChild(img);
img.src ="ReportSpellCheckerActivitiy.aspx?whatever=…..";


This will instruct the browser to load an image whose url is "ReportSpellCheckerActivitiy.aspx?whatever=....", this in turn calls your server side page ReportSpellCheckerActivitiy.aspx with whatever argument you pass in. You can examine the arguments in that page’s Page_Load and perform whatever logging there. The trick is since you are dynamically creating an image in your page, you should make sure the page does render an image when you are done with logging, otherwise a red cross will show up on your page indicating the image failed to load. The image you render is usually a 1 by 1 transparent gif so that user will not notice anything at all.

Hope this helps.

Thanks!
Luiz Ferreira
Posted: Friday, June 5, 2009 4:03:43 PM
Rank: Member
Groups: Member

Joined: 12/4/2008
Posts: 17
Hi,

Your reply did helped.
Just as a feedback, here is my solution. I am still using the StartButton to trigger the spellchecker.
In SpellCheckerDialog1 property ClientSideOnEnd I have the name of a javascript function that will set a flag to indicate that spell checker was used. The sub that writes the log file checks this flag. thanks Luiz
eo_support
Posted: Friday, June 5, 2009 4:10:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Yes. That will also do it. Thanks for sharing!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.