shankarsh1 / jquery-spellchecker

Automatically exported from code.google.com/p/jquery-spellchecker
0 stars 0 forks source link

Unable to handle spell checking of multiple fields #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add more than 1 textarea
2. jQuery("textarea:visible").each( function() {
            jQuery(this).spellchecker({
                url: "spell/checkspelling.cfm",
                lang: "en",
                engine: "google",
                suggestBoxPosition: "above"
            })
            .spellchecker("check");
        });

What is the expected output? What do you see instead?
Expected badwords under each textarea but instead it just gives me one for
the last textarea.

What version of the product are you using? On what operating system?
latest, firefox

Please provide any additional information below.

Original issue reported on code.google.com by bphilip...@gmail.com on 24 Feb 2010 at 9:58

GoogleCodeExporter commented 8 years ago

Original comment by willis...@gmail.com on 24 Feb 2010 at 11:34

GoogleCodeExporter commented 8 years ago
i guess i didn't factor in the need for this when i wrote the original code. i
believe its worth doing. i will let you know when i've committed my changes to
support this, i don't think it will take me too long. thanks for letting me 
know.

Original comment by willis...@gmail.com on 25 Feb 2010 at 7:19

GoogleCodeExporter commented 8 years ago
Thanks!  I build a lot of data entry/reporting applications in a corporate
environment and they always have lots of fields and this would be a super easy 
to way
to add spell check without having a button next to each and every field.

Original comment by bphilip...@gmail.com on 25 Feb 2010 at 7:50

GoogleCodeExporter commented 8 years ago
1 up to this one, I have the same need.

Original comment by sald...@gmail.com on 25 Feb 2010 at 8:44

GoogleCodeExporter commented 8 years ago
cool beans i've committed some fixes to support this with r142 
you can have a play at: 
http://spellchecker.jquery.badsyntax.co.uk/example-multiple.html

let me know if you have any issues with the latest code, i'll continue to test 
and
improve this functionality.
i'll also be giving this some more thought, i'm not liking that it sends 1 
request
per field. it would be rad if only one 1 request was sent to check all the 
fields

Original comment by willis...@gmail.com on 25 Feb 2010 at 9:06

GoogleCodeExporter commented 8 years ago
It doesn't look much different.  I put misspellings in both text areas and it 
shows
the misspelling from the bottom textarea under the top textarea and doesn't 
show the
misspelling from the top at all.

Original comment by bphilip...@gmail.com on 25 Feb 2010 at 9:12

Attachments:

GoogleCodeExporter commented 8 years ago
Ok there's a good chance the js file is cached by your browser. Have you 
cleared the
cache?

Original comment by willis...@gmail.com on 25 Feb 2010 at 9:13

GoogleCodeExporter commented 8 years ago
Apparently that was it.  Sorry for me mistake.  I'll download it and try to 
integrate
it in to my app.

Original comment by bphilip...@gmail.com on 25 Feb 2010 at 9:19

GoogleCodeExporter commented 8 years ago
cool beans, let me know if you have probs. the latest revision is not exactly 
stable
so i wouldn't recommend using it a production environment.

Original comment by willis...@gmail.com on 25 Feb 2010 at 9:24

GoogleCodeExporter commented 8 years ago
Works pretty well.  in IE 8 it throws an undefined error on line 112 if there 
aren't
any misspelled words, but it doesn't bomb out.

Line 112: if (!json.length) { callback.call(this.$domObj, true); return; }

Original comment by bphilip...@gmail.com on 25 Feb 2010 at 9:57

GoogleCodeExporter commented 8 years ago
I also ran into the problem that bphilippus described above on line 112. The 
problem is that callback is often null, so I modified it to be the following:

if (!json.length && callback) { callback.call(this.$domObj, true); return; }

And then added the following after it:

else if (!json.length) {
  $(this.options.wordlist.element)[this.options.wordlist.action](this.elements.$badwords.append('All words are spelled correctly.'));
  return;
}

Original comment by gustaf...@gmail.com on 20 Aug 2010 at 4:18

GoogleCodeExporter commented 8 years ago
As for the initial bug about multiple fields, I had some problems with it. I 
believe it worked correctly until I tried hiding/removing the spellchecker so 
that it only showed on one field at a time. 

If I called spellchecker('remove') and then later tried to instantiate it a 
spellchecker again, I would see the badwords box but clicking on one of the 
misspelled words would not show the suggest box even though the suggest query 
was made and successfully returned.

My fix was to call removeData('spellchecker'). I tried updating the 
spellchecker.remove function to use removeData as opposed to 
data('spellchecker') null, but that didn't appear to change anything.

Original comment by gustaf...@gmail.com on 20 Aug 2010 at 4:25

GoogleCodeExporter commented 8 years ago
This issue is fixed in the latest version of the plugin, which can be found 
here: https://github.com/badsyntax/jquery-spellchecker

You can test this issue here: 
http://jquery-spellchecker.badsyntax.co/multiple-fields.html or here: 
http://jquery-spellchecker.badsyntax.co/basic/multiple-fields.html

Original comment by willis...@gmail.com on 3 Nov 2012 at 8:16