Reputation: 262
Does anyone know a 'nice' way to prevent SmartGWT from creating TextItem form items with the spellcheck="true" set? It's annoying to get spellcheck markers on name fields etc.
The nuclear option is to hack out the problem js code from the smartGWT library, or replace the js method at runtime with:
formItem.setAttribute("getBrowserSpellCheck", JavaScriptObject.createFunction());
But this is clearly not an ideal approach.
Upvotes: 2
Views: 1090
Reputation: 31
For a regular GWT TextBox, this works for Chrome (not sure about other browsers):
myTextBox.getElement().setAttribute("spellCheck", "false");
Upvotes: 2
Reputation: 2059
setAttribute("browserSpellCheck", false);
Works on both FormItem and DynamicForm. Setting it on DynamicForm establishes a default for the whole form, which individual items can override.
Note that not every version of every browser reliably supports disabling spellcheck.
You can also use JSNI to turn it off globally on a FormItem by FormItem basis.
$wnd.isc.TextItem.addProperties({browserSpellCheck:false});
Upvotes: 3