Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    CustomValidator - ISC_Grids.js = JavaScriptException

    Problem: if I have a form with a TextItem that uses a CustomValidator, and remove the ISC_Grids.js from the html file, then I get the following exception.
    I don't know why using CustomValidator requires the "$wnd.isc.Tree" reference, but this means I can't shrink down the SmartGWT distribution if I want to use CustomValidators.
    Let me know if there is something I can do to make it easier for you to look into...

    1. the *complete* SmartGWT or SmartClient version
    SmartClient Version: v10.0p_2015-06-24/LGPL Development Only (built 2015-06-24)
    GWT 2.5.0

    2. browser(s) and version(s) involved
    FF 19
    Chrome 43
    IE 9

    5. if there is a JavaScript error, the stack trace logged in the Developer Console (see FAQ)
    Code:
    00:00:31.713 [ERROR] <E> <WebApp$1> <>com.google.gwt.core.client.JavaScriptException: (TypeError) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(11119), JavaScript object(11120), JavaScript object(11121)]): $wnd.isc.Tree is undefined
     at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
     at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
     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:242)
     at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     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:172)
     at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
     at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
     at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
     at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
     at com.smartgwt.client.util.JSOHelper.convertToJava(JSOHelper.java)
     at com.smartgwt.client.util.JSOHelper.convertToMap(JSOHelper.java:773)
     at com.smartgwt.client.util.JSOHelper.convertToMap(JSOHelper.java:791)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     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:172)
     at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
     at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
     at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:194)
     at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
     at com.smartgwt.client.widgets.form.DynamicForm.validate(DynamicForm.java)
     at org.shortpasta.smartgwtle.client.form.DynamicForm.validate(DynamicForm.java:382)
     at org.fileprotocol.portal.client.entity.layout.EditSystemApiKeyLayout.executeUpdate(EditSystemApiKeyLayout.java:156)
     at org.fileprotocol.portal.client.entity.layout.EditSystemApiKeyLayout.access$0(EditSystemApiKeyLayout.java:149)
     at org.fileprotocol.portal.client.entity.layout.EditSystemApiKeyLayout$1.onClick(EditSystemApiKeyLayout.java:85)
     at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:111)
     at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:1)
     at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
     at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
     at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
     at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
     at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
     at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     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:172)
     at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
     at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
     at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
     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:242)
     at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     at java.lang.reflect.Method.invoke(Method.java:606)
     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:172)
     at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
     at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
     at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
     at java.lang.Thread.run(Thread.java:745)

    #2
    A minimal, ready-to-run sample is always what will make this easier to look into - eliminates the possibility that we won't be able to reproduce the problem due to some detail of your environment we don't have.

    Comment


      #3
      This happens with both
      SmartGWT 4.0-2013-11-30
      SmartClient Version: v10.0p_2015-06-24/LGPL Development Only (built 2015-06-24)

      If I include ISC_Grids.js, then it works.

      1. Portal.html
      Code:
          <script src="portal/sc/modules/ISC_Core.js"></script>
          <script src="portal/sc/modules/ISC_Foundation.js"></script>
          <script src="portal/sc/modules/ISC_Containers.js"></script>
          <script src="portal/sc/modules/ISC_Forms.js"></script>
          <!--<script src="portal/sc/modules/ISC_Grids.js"></script>-->
          <script src="portal/sc/modules/ISC_DataBinding.js"></script>
          <script src="portal/sc/skins/Graphite/load_skin.js?isc_version=9.0.js"></script>
      
          <script type="text/javascript" language="javascript" src="images/cache.js"></script>
          <script type="text/javascript" language="javascript" src="portal/portal.nocache.js"></script>
      2. Portal.gwt.xml
      Code:
        <inherits name='com.google.gwt.user.User'/>
        <inherits name='com.google.gwt.visualization.Visualization'/>
        <inherits name='com.google.gwt.user.theme.standard.Standard'/>
        <!-- <inherits name="com.smartgwt.SmartGwt"/> -->
        <inherits name="com.smartgwt.SmartGwtNoScript"/>
        <inherits name="com.smartgwt.tools.SmartGwtTools"/>
        <entry-point class='org.shortpasta.smartgwttest.portal.client.Portal'/>
        <set-property name='user.agent' value='gecko1_8' />
      3. TestCustomValidator
      Code:
      import com.smartgwt.client.widgets.form.DynamicForm;
      import com.smartgwt.client.widgets.form.validator.CustomValidator;
      import com.smartgwt.client.widgets.form.fields.TextItem;
      import com.smartgwt.client.widgets.form.fields.ButtonItem;
      import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
      import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
      
      import com.google.gwt.core.client.EntryPoint;
      
      public class TestCustomValidator implements EntryPoint {
      
        /**
         * The EntryPoint interface
         * Upgrading SmartGWT from 4.0-2013-11-30 to 5.0-2015-06-25
         * On FF19 the following shows only the "A" item
         * On Chome 43 and IE9 it properly shows all items
         */
        public void onModuleLoad () {
          
          // form
          final DynamicForm form = new DynamicForm ();
          
          // items
          final CustomValidator validator = new CustomValidator () {
            @Override
            protected boolean condition (final Object object) {
              final String value = object != null ?
                object.toString () :
                null;
              if ("a".equalsIgnoreCase (value)) {
                return true;
              }
              else {
                super.setErrorMessage ("Field must be ");
                return false;
              }
            }
          };
          final TextItem nameItem = new TextItem ();
          nameItem.setTitle ("Name");
          nameItem.setValidators (validator);
      
          final ButtonItem validateButtonItem = new ButtonItem ();
          validateButtonItem.setTitle ("Validate");
          validateButtonItem.addClickHandler (new ClickHandler () {
            public void onClick (final ClickEvent event) {
              form.validate ();
            }
          });
      
          // form
          form.setFields (
            nameItem,
            validateButtonItem);
      
          // display
          form.draw ();
        }
      }
      4. Failure
      Code:
      00:00:11.207 [ERROR] (TypeError) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(858), JavaScript object(859), JavaScript object(860)]): $wnd.isc.Tree is undefinedcom.google.gwt.core.client.JavaScriptException: (TypeError) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)([JavaScript object(858), JavaScript object(859), JavaScript object(860)]): $wnd.isc.Tree is undefined
       at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
       at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
       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:242)
       at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:606)
       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:172)
       at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
       at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
       at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
       at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
       at com.smartgwt.client.util.JSOHelper.convertToJava(JSOHelper.java)
       at com.smartgwt.client.util.JSOHelper.convertToMap(JSOHelper.java:773)
       at com.smartgwt.client.util.JSOHelper.convertToMap(JSOHelper.java:791)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:606)
       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:172)
       at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
       at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
       at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:194)
       at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
       at com.smartgwt.client.widgets.form.DynamicForm.validate(DynamicForm.java)
       at org.shortpasta.smartgwttest.portal.client.layout.TestCustomValidator$2.onClick(TestCustomValidator.java:58)
       at com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:111)
       at com.smartgwt.client.widgets.form.fields.events.ClickEvent.dispatch(ClickEvent.java:1)
       at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
       at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
       at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
       at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
       at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
       at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:563)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:606)
       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:172)
       at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
       at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
       at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
       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:242)
       at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:606)
       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:172)
       at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
       at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
       at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
       at java.lang.Thread.run(Thread.java:745)

      Comment


        #4
        We've made a couple of changes to the framework that should prevent this issue for you - please restest with a build dated July 6 or later

        Comment


          #5
          I am confirming this works with the following.
          SmartClient Version: v10.0p_2015-07-06/LGPL Development Only (built 2015-07-06)

          Thanks!

          Comment

          Working...
          X