views:

181

answers:

2

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.

A: 

You need to set the "spellcheck" property of the formItem to false. I tried to set it with setAttribute and setProperty functions of the formItem but both did not work.

jaxvy
+1  A: 
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});
Charles Kendrick