|
Rank: Member
Groups: Registered
Joined: 5/27/2014 Posts: 32
|
I want an option that, If user doesn't takes any action on the highlighted word (wrong word) then spell checker should replace the wrong word with the top most word in the suggestion box. Is it possible with spell checker. ArvindB ArvindB
|
|
Rank: Member
Groups: Registered
Joined: 4/22/2006 Posts: 216
|
By default if the user just clicks 'Change' it will take the top suggestion. Do you mean that if they click 'Ignore' then it should change the word? You could just hide the Ignore and Ignore All buttons if that's what you mean. -Harry -Harry
|
|
Rank: Member
Groups: Registered
Joined: 5/27/2014 Posts: 32
|
On click of ignore it should not change the word, but if user does not takes any action and just removes the focus from the input box then it should replace all the words having error with the top suggestion. ArvindB ArvindB
|
|
Rank: Member
Groups: Registered
Joined: 4/22/2006 Posts: 216
|
If I understand correctly, then you mean that if the user starts the spell check and then the popup loses focus, you want the popup to close and all top suggestions to be used automatically. That's doable, not sure how it will go over with your users, but here you go - just add this a page called popup.jsp Code: <%@ taglib uri="http://www.keyoti.com/" prefix="RapidSpellWeb" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> <b> <script type='text/javascript'> onblur = function(){ for(var i=currentWordIndex; i<badWords.length; i++){ change(); }
} </script></b> </head> <body>
<RapidSpellWeb:rapidSpellWeb assumedApplicationEncoding="UTF-8" />
</body> </html>
and then in your page that uses the spell checker call Code: <script type='text/javascript'> rapidSpell.dialog_popupURL='popup.jsp'; </script>
(the above assumes popup.jsp is in the same folder as your page, so adjust the path accordingly, but use an absolute path, eg /somedir/popup.jsp) Hopefully you can see what it should do. -Harry -Harry
|
|
Rank: Member
Groups: Registered
Joined: 5/27/2014 Posts: 32
|
No harry, you have not understood my problem. Let me explain in brief : I am having an form in which there are multiple input type text element on which I am using your spellchecker. Now user has started typing something in first input field. He has typed complete sentence. from that sentence 2-3 words are highlighted for spell error. Now user doesn't goes to those words to correct them, he just goes out from that input element and started typing in another input tag of the form. In this situation, as a developer I want to auto correct those words for which error was shown in first input element. ArvindB ArvindB
|
|
Rank: Member
Groups: Registered
Joined: 4/22/2006 Posts: 216
|
My mistake, I guessed you were talking about dialog mode, ok for as you type add this to the page Code:
function autoCorrect(tb){ var tbs = rsw_getTBSFromID(tb.id, false); var errors = tbs.getSpanElements(); for(var i=0; i<errors.length; i++){ var embedhandler = errors[i].attributes['onmouseup'].nodeValue; var suggestions = rsw_getSuggestionsArray(embedhandler); if(suggestions.length>0){ if(suggestions[0]=='#Remove duplicate word') suggestions[0] = ""; rsw_changeTo(errors[i], suggestions[0]); i--;//we just lost an error so back pedal one } } }
and then in the textbox add Code: <textarea nospell="false" id='ta1' rows="20" cols="60" <b>onblur="autoCorrect(this)"</b>> </textarea>
Regards -Harry -Harry
|
|
Rank: Member
Groups: Registered
Joined: 5/27/2014 Posts: 32
|
Hey Harry, That trick worked.....I wanted the same result Thanks ArvindB ArvindB
|
|