znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
332 stars 82 forks source link

SectorNordAG: Pressing 'Enter' key inside of <input> triggers wrong event in AgentTicketNote. #554

Open ZTrotter opened 2 months ago

ZTrotter commented 2 months ago

Proposed change

On a page with both Save as new draft and Submit buttons, pressing the Enter key inside a element triggers the Save as new draft button by default.

In order to fix this behaviour, the following code could be added to Core.Form.js.

    $('body').on('keydown', 'input', function (Event) {
        if (Event.keyCode == 13 && $(this).closest('form').find(':submit').length > 0) {
            Event.preventDefault();
            $(this.form).find(':submit').last().click();
        }
    });

Additionally, the code that handles the user attempting to submit a form from within a