Announcement

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

    focusInNextTabElement does not submit when there is no next tab element.

    I received a request to tab to the next element when a user hits the enter key in a textarea.
    Because of the element being a textarea, my solution was to call focusInNextTabElement()
    I understand that focusInNextTabElement() should simulate a "tab" key, but it does not submit on the last tab element.

    Example code below.

    Code:
    isc.DynamicForm.create({
        fields: [
            {
                name: "a", type: "textarea",
                keyPress: function (item, form, keyName, characterValue) {
                    if (keyName === "Enter" && !EventHandler.shiftKeyDown()) {
                        form.focusInNextTabElement();
                        return false;
                    }
                    return true;
                }
            },
            {
                name: "b", type: "textarea",
                keyPress: function (item, form, keyName, characterValue) {
                    if (keyName === "Enter" && !EventHandler.shiftKeyDown()) {
                        form.focusInNextTabElement();
                        return false;
                    }
                    return true;
                }
            },
        ]
    });
    [B][/B]


    SmartClient version (available on lower left of Developer Console)

    SmartClient Version: v10.0p_2015-12-02/Pro Deployment (built 2015-12-02)

    #2
    Where are you expecting focus to go? A tab key press in this situation would normally cause focus to leave the form. If you want to instead loop back to the previous form item, focusInNextTabEment() is not documented as doing this, so you should move focus manually via focusInItem() if you want that.

    Comment


      #3
      Thanks for the response.

      When focus is on the last formItem, I'm expecting focusInNextTabElement() to leave the form and submit like "Tab" would do.

      Comment


        #4
        Yes, it's clear that you expect that, however, that's not what the method does, and not what it is documented to do. There is no next focusable Canvas, so the method does nothing. See our previous response for what you can do if you need another behavior.

        Comment

        Working...
        X