Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

help with spellcheck dialog - RapidSpell Web ASP.NET - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
kl123
#1 Posted : Monday, March 24, 2014 6:47:38 PM
Rank: Member

Groups: Registered

Joined: 3/24/2014
Posts: 7
Hi,

I am trying to dynamically create a spellcheck button to launch the spellcheck dialog and I need to trigger the onchange event if the text is changed. The spellcheck button should only check a specific textbox. I couldn't find the documentations on how to set up the RapidSpellWebLauncher, so I am not sure if this is correct. I am open to other ways of setting up the spellchecker to achieve this. Any reference or help would be great.

I have this code in the code behind
...
RapidSpellWebLauncher spellCheckButton = new RapidSpellWebLauncher();
spellCheckButton.ID = "_launcher";
spellCheckButton.TextComponentInterface = TextComponentInterfaceType.Custom;
spellCheckButton.RapidSpellWebPage = "../../Keyoti_RapidSpell_Web_Common/POPUP.ASPX";
spellCheckButton.TextComponentName = "TBox";
...


I have these functions in the master:
function RSCustomInterface(tbElementName) {
this.tbName = tbElementName;
this.getText = getText;
this.setText = setText;
function getText() {
return document.getElementsByName(this.tbName)[0].value;
//return eval('document.' + this.tbName + '.value');
}
function setText(text) {
var oldText = this.getText();
document.getElementsByName(this.tbName)[0].value = text;
//eval('document.' + this.tbName + '.value = text');
if (oldText != text) {
//eval('document.' + this.tbName + '.onchange.call()');
document.getElementsByName(this.tbName)[0].onchange.call();
}
}
}

When I click on the spell check button, I get this error:
Microsoft JScript runtime error: Unable to get value of the property 'document': object is null or undefined


Thanks.
harry
#2 Posted : Monday, March 24, 2014 7:52:44 PM
Rank: Member

Groups: Registered

Joined: 4/22/2006
Posts: 216
Hi, can I quickly ask which version you're using please?

Also, is there a reason you want to use the RSCustomInterface?

Thanks


-Harry
-Harry
kl123
#3 Posted : Monday, March 24, 2014 7:55:03 PM
Rank: Member

Groups: Registered

Joined: 3/24/2014
Posts: 7
I wanted the textbox onchange event to be triggered when the spellchecker corrects the text in the textbox.
kl123
#4 Posted : Monday, March 24, 2014 8:00:13 PM
Rank: Member

Groups: Registered

Joined: 3/24/2014
Posts: 7
I am using version 3.8.11.418
harry
#5 Posted : Tuesday, March 25, 2014 4:48:58 AM
Rank: Member

Groups: Registered

Joined: 4/22/2006
Posts: 216
Thanks, I ask because it can be done differently in v4.

Sorry I don't know why you would get "Unable to get value of the property 'document': object is null or undefined" from the custom interface, but I would suggest

i) Don't set spellCheckButton.TextComponentInterface = TextComponentInterfaceType.Custom;

ii) Set spellCheckButton.TextComponentName to the ClientID of TBox, rather than the name - it's more reliable.

iii) Set spellCheckButton.FinishedListener="notifyDone" and spellCheckButton.FinishedListenerInformState=true;


<script type='text/javascript'>
function notifyDone(completed){
alert('Finished event captured spell check was complete '+completed);
}
</script>

You might also like (for server side) http://keyoti.com/produc...ll%20Check%20Finish.htm

Here are the docs for v3 btw http://keyoti.com/produc...ocumentation/Index.html



-Harry
-Harry
kl123
#6 Posted : Tuesday, March 25, 2014 12:18:03 PM
Rank: Member

Groups: Registered

Joined: 3/24/2014
Posts: 7
Thanks for your prompt reply.



I changed my code to the following:
...
RapidSpellWebLauncher spellCheckButton = new RapidSpellWebLauncher();
spellCheckButton.ID = "_launcher";
spellCheckButton.RapidSpellWebPage = "../../Keyoti_RapidSpell_Web_Common/POPUP.ASPX";
spellCheckButton.TextComponentName = tbx.ClientID;
spellCheckButton.Finish += new EventHandler(RapidSpellWebMultiple_Finish);
...

private void RapidSpellWebMultiple_Finish(object sender, EventArgs e)
{
TBX_TextChanged(sender, e);
}

Removed the javascript functions in the master


When I click on the spellcheck button, I still get the same error. It is coming from the underlined code below.

function RS_writeDoc(toWindow, isSafari){ toWindow.document.open(); toWindow.document.write(spellBoot);
toWindow.document.close(); if(isSafari) toWindow.document.forms[0].submit(); }
harry
#7 Posted : Tuesday, March 25, 2014 4:01:16 PM
Rank: Member

Groups: Registered

Joined: 4/22/2006
Posts: 216
Are you using a RapidSpellWebMultiple control?

Can I see more of your code, such as in what context you're doing the above, where you're adding spellCheckButton and any other controls of ours?

Thanks

-Harry
-Harry
kl123
#8 Posted : Tuesday, March 25, 2014 4:22:03 PM
Rank: Member

Groups: Registered

Joined: 3/24/2014
Posts: 7
No I did not use the RapidSpellWebMultiple control. Do I need to use it? The code that I have shown is all the code that I have that uses Keyoti's controls. It would be great if you can provide a working example for a spellcheck button that opens a dialog and spellchecks a specific textbox and triggers the on change event.
harry
#9 Posted : Tuesday, March 25, 2014 5:33:41 PM
Rank: Member

Groups: Registered

Joined: 4/22/2006
Posts: 216
>No I did not use the RapidSpellWebMultiple control. Do I need to use it?

No you don't.

I wonder if this fixes your problem?
http://keyoti.com/kb/Def...ew&questId=136&catId=60

The error isn't what I would expect, but it should help.

I can give you an example, but I suspect it being so simple, it's not going to reproduce your problem - can you shed more light on what you're doing, eg. is AJAX involved? are you calling the code above in a button handler? how do you add spellCheckButton to the form? is DHTML/JQuery involved? is spellCheckButton added inside an iframe?

The devil will be in the details.

Thanks



-Harry
-Harry
kl123
#10 Posted : Wednesday, March 26, 2014 1:37:47 PM
Rank: Member

Groups: Registered

Joined: 3/24/2014
Posts: 7
I found out that it was the javascript file (RapidSpell-DIALOG.js) that I included that caused the error. After removing it, I don't get the error anymore.

I just have a question about the Finished event. I would like to know if the text was changed. Is there any property that would give me this information?

I tried SpellCheckText, but it didn't give me the text in the textbox before spellcheck, so i can't compare the text.
harry
#11 Posted : Wednesday, March 26, 2014 6:44:42 PM
Rank: Member

Groups: Registered

Joined: 4/22/2006
Posts: 216
Glad you found the problem and let us know the cause, thanks. For anyone else, RapidSpell-DIALOG.js is a replacement for the controls and shouldn't be used with them. It's also for v4, only.

quote:

I just have a question about the Finished event. I would like to know if the text was changed. Is there any property that would give me this information?



I'm afraid not - to do that you have to go back to what you were doing before, using the custom interface and not using the Finished event.

Code:

function RSCustomInterface(tbElementName) {
this.tbName = tbElementName;
this.getText = getText;
this.setText = setText;
function getText() {
return document.getElementById(this.tbName).value;
}
function setText(text) {
var oldText = this.getText();
document.getElementById(this.tbName).value = text;

if (oldText != text) {
document.getElementsById(this.tbName).onchange.call();
}
}
}


(I changed it to use getElementById)



-Harry
-Harry
kl123
#12 Posted : Wednesday, March 26, 2014 7:07:56 PM
Rank: Member

Groups: Registered

Joined: 3/24/2014
Posts: 7
Thanks for your help Harry. I will try this again.
Forum Jump  
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.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.