Disable spell check for People Picker

People picker control just contains login names and it should not be checked for spellings but SharePoint does it. Practically it is not acceptable so we have to restrict this. I have written small javascript code to inject this.

In OOB we have one property (excludeFromSpellCheck) to avoid spell check for specific controls. But by default it will not work for people picker control because it is collection of input controls. If you inspect the control using IE developer toolbar you can find the login details hold by textarea field. So using following script I am setting above property to avoid spell check. 

<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("disableSpellCheckOnPeoplePickers");
  
function disableSpellCheckOnPeoplePickers() {
    var inputs = document.getElementsByTagName('TextArea');
  
    for (var index = 0; index < inputs.length; index++) {
        var input = inputs[index];
        if (input.title == 'People Picker') {
            input.setAttribute('excludeFromSpellCheck', true);
        }
    }
}</script>

Comments

  1. Where do you add the script, I have infopathform and i put a spell check, it works fine but it spell checks people pickers, where can i add this code.

    ReplyDelete
  2. As per my knowledge, by default InfoPath will not have spell check feature. So I would like to understand how did you achieve this? For your information the above script works for only html forms.

    ReplyDelete
  3. Yes you can put spell check on Infopath.
    This piece of code saved my day!!!
    Thanks!

    ReplyDelete
  4. If you are using default list form then add it in edit-form

    good information

    ReplyDelete

Post a Comment

Popular posts from this blog

Switch from Classic to Claims Authentication in SharePoint 2010

How to query list data using web service