views:

261

answers:

1

I'm creating a browser based QC/data entry app that will let people edit OCRed files, which naturally have tons of errors. Chunks of data are put in textareas so they can be checked, but the red underlines only appear when the user manually puts the cursor in a misspelled word.

Is there a way to force WebKit to add the little red spell check underlines to textareas?

+1  A: 

I have no idea if this will actually work or not, but you might want to try playing with the selection stuff. In other words, after you update your textarea (and want to "refresh" it to make the red underline show), you might be able to do something like:

var length = document.getElementById('TEXTAREA#your').value.length;
document.getElementById('TEXTAREA#your').setSelectionRange(0, length);

You can find a bit more on how to use selections here: http://stackoverflow.com/questions/1736264/how-do-i-select-arbitrary-text-on-the-page-using-javascript or via a Google search.

My thinking is that creating a selection (or maybe clearing it after you create it) might trigger a different browser event which causes the spellcheck refresh ... but that's just an idea; it might do the same exact thing as setting textArea.value (ie. nothing).

machineghost
This is a good idea. I was also thinking of running the cursor through each textarea word by word, but that will probably take enough time to annoy the user.
sakabako
Let me know if it works out or not; now you've got me curious :-)
machineghost
I will post if I try, but this is a small part of a rushed project.
sakabako