Submit on return key vs. Selectize behaviour

Submit on return key vs. Selectize behaviour

fabianrottfabianrott Posts: 30Questions: 1Answers: 0

Hi!
I want to use Selectize in my project. When I open a Selectize field in Editor (doesn't matter if main or inline mode), the dropdown opens. The problem is: now I can mark an entry with the arrow keys or by typing, but if I want to select the item with the return key, the Editor also gets the keypress event and submits the changes.
This would be ok if it was inline mode and only a single entry to select, but breaks multi-select and the main editor form.

You can see this in a DataTables live example that I found in another post: http://live.datatables.net/vanibenu/1/edit
The submit process does not work here, but it is initiated, as you can see from the progress indicator.

It would be great if the behaviour here were similar to a normal select input: select marked entry if the list is open, submit otherwise.

Replies

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Hi,

    Thanks for posting this. I'm afraid that, at the moment, there isn't actually away of achieving that. Editor, when listening for the return key, will check to see if the element that has focus is an input element or not. Any other element and it won't submit.

    Since selectize does use an input element, Editor will listen for the return key and act upon it. There isn't currently a way to override that (other than to disable it).

    Perhaps the plug-in system in Editor should attempt to query the plug-ins and see if the return key should be handled by Editor or not.

    That will take a little bit of work I'm afraid and probably won't make it in until 1.6. I've made a note of this thread so it can be updated when this is implemented.

    Thanks for the suggestion!

    Regards,
    Allan

  • fabianrottfabianrott Posts: 30Questions: 1Answers: 0

    Hi Allan,

    I was afraid you'd say that. Thank your for looking into this, it would be great to see this in future versions.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Quick update on this for anyone who finds this thread. Editor 1.6 (which will drop in early December) will allow field type plug-ins to control what the return key does. The mechanisim for that is a new canReturnSubmit function that the plug-in can specify. It will be documented in the plug-ins manual.

    Allan

This discussion has been closed.