Today I have had an issue where the spell checking feature in a SharePoint list item form was picking up a spelling error in a managed metadata field. I know what you are thinking – one of the benefits of the term store and managed metadata is that spelling mistakes should be eradicated as terms are chosen from a fixed set, where the term store is centrally managed as it is here. However, what if the term entered by the term store administrator is a recognised term in certain contexts but is clearly not in the SharePoint dictionary? My example here is ‘Pharma’.
My first thought was to exclude the managed metadata fields from the spell checker for the same logic – assume that the centrally managed term store is always correct and if not will be corrected centrally. There seems little point checking a field which hasn’t been typed in by the user – it has been selected. OK, so back to a trick I have used for excluding the People Picker field from the spell check. However, after a while of trying to add the ‘excludeFromSpellCheck’ attribute to various elements I conceded defeat . It seems that the way the managed metadata item picker populates its value and hence generates the HTML prevents this attribute being added. (If you know differently please add a comment below!).
That is when I hit upon a much simpler solution. Why exclude the field? Just add a custom dictionary and include the terms that fail the check into it! To do so follow these steps:
- Create a document library in the root site of your site collection called ‘Spelling’.
- Create a text document with the file name ‘Custom Dictionary.txt’, the contents of which should be your custom terms – one to each line. In my case here this was a single line with the term ‘Pharma’.
- Upload ‘Custom Dictionary.txt’ to your ‘Spelling’ document library.
- That’s it!
Now when I went back and performed my spell check the field containing ‘Pharma’ no longer reported an error. Superb!