I built a form which have a text field for take input from user.

Now I want to implement a spell check module or something which can check spell when user type some word or sentence in the text field. I Googled a lot but didn't find any result for my search. Find spell checker for WYSIWYG editor but not for my search.

How can I implement spell checker for text field in a form.

  • Can you please elaborate? When do you want to check the input? while typing? or after submission? Some thing like Results show: Did you mean [some suggestion]?. like in Google. – Krishna Mohan Nov 14 '14 at 6:19
  • I want to implement the spell check while typing. If I will not find any solution to check spell while typing then I can use the check spell after submit. – Subhajyoti De Nov 14 '14 at 6:27

You can use HTML spellcheck Attribute for the textfield. The spellcheck attribute is new in HTML5.

The spellcheck attribute specifies whether the element is to have its spelling and grammar checked or not.

You can use this attribute in your textfield like follows. I've tested this and working fine.

  $form['check'] = array(
        '#type' => 'textfield',
        "#attributes" => array("spellcheck" => "true")
| improve this answer | |
  • 1
    Small code. But huge benefit. Thanks. – Subhajyoti De Nov 14 '14 at 7:04
  • @SubhajyotiDe Glad to hear that. :) – Krishna Mohan Nov 14 '14 at 7:05

There is nothing ready made solution available to this you need to make your custom module for the same I can give you some information about how can you achieve this:

you can start with module Spell Checker it is for drupal 6 so for D7 you need to enhance the same, it uses jQuery spell-checker plugin and integrated that as Drupal module.

also there is a paid service available if you are interested http://www.phpspellcheck.com/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.