[SOLVED] Spell check in textarea (longshot question)
Moderator: General Moderators
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
[SOLVED] Spell check in textarea (longshot question)
I have this rather fussy client who wants the user (employees) to be able to use a spellchecker in a textarea of an input form. Yeah, in the browser, which might be anything.
Right. I'm holding my breath.
Right. I'm holding my breath.
- Sevengraff
- Forum Contributor
- Posts: 232
- Joined: Thu Apr 25, 2002 9:34 pm
- Location: California USA
- Contact:
- mrvanjohnson
- Forum Contributor
- Posts: 137
- Joined: Wed May 28, 2003 11:38 am
- Location: San Diego, CA
Dude, only the greatest piece of Open Source code out there.
HTMLArea - http://www.interactivetools.com/products/htmlarea/
This thing is great and what I had been looking for for years. A WYSIWYG editor for form text areas. The new beta version 3.0 I believe has Spell Check thanks to a Perl module tie in. So you need to have Perl aviable. Check it out. Some people had broken doen the product into PHP functions but I can't seem to get it working a the JavaScript version works good. Problem is it isn't very compatiable with other browser besides IE sorry
Also, there is a module for phpBB that add Spell Checking to the text area to create postings. I use it on my board. If I find where I got the module I'll add a link but I think they use the phpSpell that Sevengraff referred to. Maybe you can break down that module to understand how they do it.
HTMLArea - http://www.interactivetools.com/products/htmlarea/
This thing is great and what I had been looking for for years. A WYSIWYG editor for form text areas. The new beta version 3.0 I believe has Spell Check thanks to a Perl module tie in. So you need to have Perl aviable. Check it out. Some people had broken doen the product into PHP functions but I can't seem to get it working a the JavaScript version works good. Problem is it isn't very compatiable with other browser besides IE sorry
Also, there is a module for phpBB that add Spell Checking to the text area to create postings. I use it on my board. If I find where I got the module I'll add a link but I think they use the phpSpell that Sevengraff referred to. Maybe you can break down that module to understand how they do it.
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Added question: phpspell seems to be the solution, since some of the employees don't use IE, and I believe a couple even use a Mac.
However, the producer's setup instructions only describe using it with various bulliten boards and the contact page is gone missing from their site. Has anyone used this for a simple form that could share the installation and coding procedure for that process with me?
Also, there is some loose talk of "database" and "mysql" is mentioned in passing. Is a mysql database part of the requirement? If so, how is it created. Most servers (including the one I use) have limits on this sort of activity.
Hmmm. This is looking less like a solution. Information is a bit skimpy.
However, the producer's setup instructions only describe using it with various bulliten boards and the contact page is gone missing from their site. Has anyone used this for a simple form that could share the installation and coding procedure for that process with me?
Also, there is some loose talk of "database" and "mysql" is mentioned in passing. Is a mysql database part of the requirement? If so, how is it created. Most servers (including the one I use) have limits on this sort of activity.
Hmmm. This is looking less like a solution. Information is a bit skimpy.
- mrvanjohnson
- Forum Contributor
- Posts: 137
- Joined: Wed May 28, 2003 11:38 am
- Location: San Diego, CA
I know PHPSpell uses a MySQL DB. Looks like all the installs are for Bulletin Board and CMS modules.
If you don't want to use a Database, what would you want to use for the dictionary, a text file?
Like I mentioned, the HTMLArea uses a Perl Module to talk to an online Dictionary, perhaps you can break down that JavaScript and Perl and figure out something for yourself.
The only other thing I can thing of off the top of my head, if you can’t use any other language but PHP and you don’t have access to a database is to create a dictionary flat file and make some creative Regular Expressions. Then parse your input from a text area against the Dictionary File looking for words that aren’t in the dictionary file (by loading the flat file into an array). If it comes across one, use RegEx to determine a word to recommend. It would be a lot of overhead but it’s a work around.
If you do this, make the code a project that other people can contribute to and see how much better it gets. I’m sure there are a lot of people who would like a spell checker that isn’t dependent on anything but PHP with no database required.
If you don't want to use a Database, what would you want to use for the dictionary, a text file?
Like I mentioned, the HTMLArea uses a Perl Module to talk to an online Dictionary, perhaps you can break down that JavaScript and Perl and figure out something for yourself.
The only other thing I can thing of off the top of my head, if you can’t use any other language but PHP and you don’t have access to a database is to create a dictionary flat file and make some creative Regular Expressions. Then parse your input from a text area against the Dictionary File looking for words that aren’t in the dictionary file (by loading the flat file into an array). If it comes across one, use RegEx to determine a word to recommend. It would be a lot of overhead but it’s a work around.
If you do this, make the code a project that other people can contribute to and see how much better it gets. I’m sure there are a lot of people who would like a spell checker that isn’t dependent on anything but PHP with no database required.
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
HTMLArea is supported for IE only, so like IEspell that isn't going to provide a solution. My customer's employees use various browsers, including Macs.
The site in question is currently using a mysql database, so if phpspell merely adds a table to that database that's not a problem. If it attempts to create a new database that will be a problem. The producer's documemtation doesn't say.
Kind of hard to believe that this utility can only be used with a bulliten board. I'm hoping soneone can (a) give me pointers on how to use it in a simple form, or (b) tell me how to contact the producer, since there is no contact information on the producer's site.
The site in question is currently using a mysql database, so if phpspell merely adds a table to that database that's not a problem. If it attempts to create a new database that will be a problem. The producer's documemtation doesn't say.
Kind of hard to believe that this utility can only be used with a bulliten board. I'm hoping soneone can (a) give me pointers on how to use it in a simple form, or (b) tell me how to contact the producer, since there is no contact information on the producer's site.
- Sevengraff
- Forum Contributor
- Posts: 232
- Joined: Thu Apr 25, 2002 9:34 pm
- Location: California USA
- Contact:
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Thanks, Sevengraff, I believe I have the gist of it. One point for clarification (since you have done this successfully yourself).
b) that would consist the following change if I am correct:
Am I on the right track?
a) I think I'm seeing it referenced five times actually.You will also need to edit the Spellmessage.js file and change where the field links to on all four lines it is referenced.
b) that would consist the following change if I am correct:
Code: Select all
LinkToField = document.forms[0].message;
// since the textarea is named "description"
LinkToField = document.forms[0].description;- Sevengraff
- Forum Contributor
- Posts: 232
- Joined: Thu Apr 25, 2002 9:34 pm
- Location: California USA
- Contact:
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Hmmmm, not working for me. The installation was no problem, and the database table was created properly. I am not getting a spell check, however. When I click on the button nothing happens and there is an "error on page" message in the status bar of my (IE 5.5) browser.
Here is the relevant code:
Here is the spellmesasage.js code:
Any ideas what the "error on page" is?
Here is the relevant code:
Code: Select all
<HEAD>
<TITLE>Foobash Company of San Diego California</TITLE>
<link href="../foobash.css" rel="stylesheet" type="text/css">
</HEAD>
<script language='javascript' src='spelling/spellmessage.js'></script>
<BODY TEXT="#0000b0" BGCOLOR="#ffffff" LINK="#0000b0" VLINK="#0000b0" ALINK="#0000b0">
<center>
<form method='post' action='subreport.php'><table width=720>
<tr><td class="black-6" width=720 colspan=4>Other observations<br>
<textarea name="narr" rows=3 cols=86></textarea><br>
<input type="button" class="" Value="Spell Check" onclick="openspell();"></td></tr>Code: Select all
if (ie4) LinkToField = self.post.narr;
if (gecko) {
LinkToField = parent.document.post.narr;
height = height + 6;
}
if (op6) {
LinkToField = document.formsї0].narr;
height = height + 10;
width = width + 10;
}
if (op7) LinkToField = document.formsї0].narr;
if ((op6 || op7) && typeof(LinkToField) == "undefined") LinkToField = document.formsї1].narr;