Announcement

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

    ENTER Key doesn't work?

    I have the following test case:
    Code:
    public void onModuleLoad() {
    
            final VLayout vlayout = new VLayout();
            DynamicForm df = new DynamicForm();
            TextItem ti = new TextItem();
            df.setFields(ti);
            df.setSaveOnEnter(true);
            ti.addKeyDownHandler(new KeyDownHandler() {
                
                @Override
                public void onKeyDown(KeyDownEvent event) {
                    SC.say(event.getKeyName());
                    if (event.getKeyName().equals("Enter")) {
                        SC.say("enter");
                    }
                }
            });
            ti.setSaveOnEnter(true);
            vlayout.addMember(df);
            vlayout.draw();
            
        }
    When I press any key, it works ( I get the key name), but when I press "Space" or "Enter", nothing happens. The setSaveOnEnter(true) is also not working, I think because of the same reason.
    Using Samrtgwt 5.0p power 5.0-p20150919 and Chrome 47.0.2526.106 (64-bit) on a mac (10.11.2)

    #2
    I tried with windows: the same behavior

    Comment


      #3
      Isomorphic?

      Comment


        #4
        Am I missing some information or why am I not getting any answer ?

        Comment


          #5
          Your support shows as expired, and this does not look like a plausible bug, so it is queued behind lots of other things.

          Comment


            #6
            why does this not look as a plausible bug? Shouldn't the keyHandler work?

            Comment


              #7
              Not all events fire for all keys due to native browser bugs, and your claim that saveOnEnter is outright broken should have triggered autotest failures or other complaints.

              But we're just chiming in here because you previously had support - if you want to argue about whether your bug report was triaged correctly, that too is something you need a Support contract to do!

              Comment


                #8
                I am not claiming the the saveOnEnter is broken. I am claiming that the KeyDownHandler is not triggering for the ENTER key. All other keys work correctly, as you can see in my very simple testcase. But when pressing ENTER nothing happens, thus the handler is not being called.
                In my opinion this is a clear bug. Or is it desired that the KeyDownHandler triggers when pressing all keys with the exception of the ENTER key?

                Comment


                  #9
                  Again, the browser doesn't send keyDown for some keys in some circumstances. We haven't looked at whether this is one of those cases.

                  Since you said:

                  The setSaveOnEnter(true) is also not working
                  .. but now you say:

                  I am not claiming the the saveOnEnter is broken.
                  We're not sure what this report means anymore! But anyway, again, it's queued, renew your Support if you need prompt attention.

                  Comment


                    #10
                    Both don't work. Please take a look at my testcase. It is not being called when pressing ENTER.

                    Comment


                      #11
                      If you move the form.setFields() call so that it comes *after* you set up the TextItem and add the key-handler, does everything work? That is, create your TextItem and set it up fully, including installing your key-hander and other calls, *before* you add it to the form.

                      Comment


                        #12
                        No, this doesn't help

                        Comment


                          #13
                          We're looking at it and will update when we have more information.

                          Comment


                            #14
                            Your code is actually working - but your use of multiple calls to SC.say() in handlers is causing thread issues.

                            Just change those calls from SC.say() to SC.logWarn(), and you'll see both logs in the console, along with a warning about form.saveData() (confirming that saveOnEnter is working, but the form is not databound).
                            Last edited by Isomorphic; 19 Feb 2016, 09:27.

                            Comment


                              #15
                              Yes, you are right, SC.logWarn() shows both logs.
                              What I am trying to do is to let the user enter a date and save it with the ENTER key.
                              It is "almost" working, but now I get incorrect results when entering an invalid date.
                              Here is the testcase:
                              Code:
                              @Override
                                  public void onModuleLoad() {
                              
                                      final VLayout vlayout = new VLayout();
                                      DynamicForm df = new DynamicForm();
                                      final DateItem di = new DateItem();
                                      di.setUseTextField(true);
                                      di.setUseMask(true);
                                      di.setEnforceDate(true);
                                      di.addKeyDownHandler(new KeyDownHandler() {
                                          
                                          @Override
                                          public void onKeyDown(KeyDownEvent event) {
                                              if (event.getKeyName().equals("Enter")) {
                                                  if (di.validate()) {
                                                      SC.logWarn("Validation correct!");
                                                      di.blurItem();
                                                      SC.logWarn(di.getValue()+"");
                                                  }
                                              }
                                          }
                                      });
                                      df.setFields(di);
                                      vlayout.addMember(df);
                                      vlayout.draw();
                                      
                                  }
                              If you enter "12" and then "Enter", you get the following in the console:
                              Code:
                              10:40:11.912:KDN3:WARN:Log:Validation correct!
                              10:40:11.915:IBLR4:WARN:DateItem:isc_DateItem_1[isc_DateItem_0]:Invalid date string entered in date text field :12.  .
                              10:40:11.917:KDN3:WARN:Log:12.  .
                              So the validation is returning "true", although "12" is not a valid date.

                              Comment

                              Working...
                              X