I need to validate a text item’s content(a website entry) to a regular expression.I coded as below…
RegExpValidator regExpValidator = new RegExpValidator();
regExpValidator.setExpression( "(http://){0,1}+(www:)+[a-zA-Z0-9]+\\.+[a-zA-Z]{2,}$");
TextItem webName=new TextItem();
webName.setValidators(regExpValidator);
I called form.validate() somewhere in the class.But when i hit the submit button and runs form.validate() method it is reporting errors as below.
Uncaught JavaScript exception [com.google.gwt.dev.shell.HostedModeException: Expected primitive type boolean; actual value was undefined
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:51)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:148)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
at com.smartgwt.client.widgets.form.DynamicForm.validate(DynamicForm.java)
at com.example.myproject.client.CreateSchool$1.onClick(CreateSchool.java:126)
at com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:96)
at com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)] in http://localhost:65201/gwtproj/hosted.html?gwtproj, line 8
when i give another regular expression it is doing what it is supposed to do.But it is not doing so with my regular expression.can anyone please help me out…!
Thanks…