TheManWithNoName
TheManWithNoName

Reputation: 262

Proper way to disable browser spellcheck in Smart GWT?

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

Answers (3)

jaxvy
jaxvy

Reputation: 5090

You need to set the spellcheck property of the formItem to false.

Upvotes: 0

Carl
Carl

Reputation: 31

For a regular GWT TextBox, this works for Chrome (not sure about other browsers):

myTextBox.getElement().setAttribute("spellCheck", "false");

Upvotes: 2

Charles Kendrick
Charles Kendrick

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

Related Questions