iModernize - The Profound Logic Software Blog

Tips and Tricks: Spell Check

Posted by Rob Ferguson on Sep 10, 2014 6:38:05 AM

We have become accustomed to, or perhaps reliant on spell checkers in almost all tools we use to document or write. Some may argue that the spell checker makes us lazy, others will say that it makes us more efficient but we all recognize and use the familiar red squiggly lines that appear on screen as we type.

If you have text boxes or text areas in a web interface allowing a user to enter comments or other narrative, a spell checker can be a useful tool. If the quality of the text is important you may find that your users are using a word processor to author the text and then copy & paste to the text area, but with the advent of HTML5 this extra step can be eliminated.

HTML5 has a spell check attribute aptly name spellcheck that can be set to true for any input element. Simply setting this attribute to true will enable this feature. The html is as follows.

<input type=“textbox” spellcheck=”true” />
<textarea spellcheck=”true”> </textarea>

In Profound UI of course we generate the html/json for you so you don’t need deal directly with the html but you can enable the spellcheck property on textbox/text area widgets with a single line of JavaScript. At the moment there is not a spellcheck property for these widgets (we may add one in the future) but you can enable the spell checker as follows.

You will need the id of the text box or text area for which you want enable spell check. On the (control) record format there is an event property called onload. In this property add a line in the following format:
getObj(“YourtextBoxId”).spellcheck=true;

Below is an example.

onload property

This is how it appears at run tme.

Job application example

 

You may then want to test the spell checker with the following:

Eye have a spelling chequer,
It came with my Pea Sea.
It plane lee marks four my revue
Miss Steaks I can knot sea.

Eye strike the quays and type a whirred
And weight four it two say
Weather eye am write oar wrong
It tells me straight a weigh.

Eye ran this poem threw it,
Your shore real glad two no.
Its vary polished in its weigh.
My chequer tolled me sew.

A chequer is a bless thing,
It freeze yew lodes of thyme.
It helps me right all stiles of righting,
And aides me when eye rime.

Each frays come posed up on my screen
Eye trussed too bee a joule.
The chequer pours o'er every word
Two cheque sum spelling rule.

Jerrold H. Zar

Topics: Tips and Tricks

Subscribe to Blog Updates

....and get The 2017 State of IBM i Modernization White Paper FREE!

cover page.png

Recent Posts