I'm trying to set a range validator of a FormItem after a fetch using values from DSResponse.getData(). I'm getting this exception when calling setValidators() though:
Here is my code:
I get the same thing trying to calling item.setValidators(new RequiredIfValidator()) too.
Code:
2011-08-10 14:28:36,156 [FATAL] Uncaught Exception:
com.google.gwt.core.client.JavaScriptException:
(TypeError): 'setValue' is null or not an object
number: -2146823281
description: 'setValue' is null or not an object
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Thread.java:619)
Code:
public FloatRangeValidator newFloatRangeValidator(float min, float max) {
FloatRangeValidator validator = new FloatRangeValidator();
validator.setMin(min);
validator.setMax(max);
return validator;
}
...
// In fetch callback
FormItem item = valuesManager.getItem("name");
// Exception occurs here. Didn't work with values from response either
item.setValidators(newFloatRangeValidator(0, 1));
Comment