a memo
Need to integrate a spelling checker into your web application? Open Spellcheck.php as a pop-up window and you're basically there!
Spellcheck.php is a handy widget that spellchecks some block of text using aspell. It's a better way to spellcheck with PHP than any of PHP's own spellchecking functions.
There is a show-source link that will allow you to save the PHP code locally.
Spellcheck.php requires a working GNU aspell installation. It could also be configured for use with some other checker, please send me details if you do this.
A future version might include hooks for Javascript, but for now, see the following email response:
On 7/19/05, pete@----.co.uk wrote:
> How would I take one php form (existing with validation checking) and have
> a button which creates the pop up which grabs the text?
You can use a JavaScript function to both open a popup window and grab
the value of the form field that you want to check. Set the following
function as the button's onclick, where id is the id attribute of the
textarea you want to check:
Something like that. You'll need to make sure the form elements
function spellcheck( id ) {
sw = window.open('/spellcheck.php','spellcheck',
'scrollbars=yes,width=600,height=400,status=yes');
textval = document.getElementById( id ).value;
sw.document.getElementById( 'text' ).value = textval;
}
involved have id attributes in addition to name attributes in order to
work with getElementById(). You will need to modify spellcheck.php for
this to work.
The code to get the spellchecked text *back* into the original form is
a little trickier. But any JavaScript window can access form elements
in the window that originally opened it. So tie a function like this
to the "return" button after text has been spellchecked, where id is
again the id of the textarea on the original form (your validated PHP
form):
That's pretty barebones, but hopefully enough to get you started?
function returnChecked( id ) {
ow = window.opener;
textval = document.getElementById( 'text' ).value;
ow.document.getElementById( id ).value = textval;
window.close();
}
By Chris Snyder on December 19, 2002 at 11:00pm