Bug 15911

Summary: Use noEnterSubmit CSS class instead of prevent_submit.js
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jdemuth, jonathan.druart, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9507
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js
Bug 15911: (follow-up) Allow enter to submit using the submit button
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js
Bug 15911: (follow-up) Allow enter to submit using the submit button

Description Owen Leonard 2016-02-24 19:43:00 UTC
The JavaScript file prevent_submit.js seems to be doing the same work that the .noEnterSubmit CSS class does via staff-global.js.

If so, the extra file should be removed and the templates modified to work with staff-global.js.
Comment 1 Owen Leonard 2019-02-22 14:43:57 UTC
Created attachment 85539 [details] [review]
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js

This patch removes the use of a separate js file, prevent_submit.js, in
favor of using a CSS class to trigger the same functionality in
staff-global.js.

To test, apply the patch and test the following pages to confirm that
pressing "Enter" when the cursor is in any field in the main form does
not submit the form.

 - In Acquisitions, add to a basket from a new (empty) record
 - In Acquisitions, receive an order line
 - In Serials, locate a subscription and open the "Edit serials" page
   from the "Serial collection" page.
Comment 2 Hayley Pelham 2019-03-05 01:17:45 UTC
Created attachment 86046 [details] [review]
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js

This patch removes the use of a separate js file, prevent_submit.js, in
favor of using a CSS class to trigger the same functionality in
staff-global.js.

To test, apply the patch and test the following pages to confirm that
pressing "Enter" when the cursor is in any field in the main form does
not submit the form.

 - In Acquisitions, add to a basket from a new (empty) record
 - In Acquisitions, receive an order line
 - In Serials, locate a subscription and open the "Edit serials" page
   from the "Serial collection" page.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 3 Jonathan Druart 2019-03-06 16:22:11 UTC
I think the following part was important:
-        && e.target.nodeName == "INPUT"
-        && e.target.type != "submit"

We want to submit form when pressing enter on the submit button, right? :)
Comment 4 Owen Leonard 2019-03-06 18:44:36 UTC
Created attachment 86205 [details] [review]
Bug 15911: (follow-up) Allow enter to submit using the submit button

This patch modifies the checkEnter function so that it is possible to
submit a form by tabbing to the submit button and hitting ENTER to
submit.
Comment 5 Katrin Fischer 2019-03-09 20:33:04 UTC
Created attachment 86412 [details] [review]
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js

This patch removes the use of a separate js file, prevent_submit.js, in
favor of using a CSS class to trigger the same functionality in
staff-global.js.

To test, apply the patch and test the following pages to confirm that
pressing "Enter" when the cursor is in any field in the main form does
not submit the form.

 - In Acquisitions, add to a basket from a new (empty) record
 - In Acquisitions, receive an order line
 - In Serials, locate a subscription and open the "Edit serials" page
   from the "Serial collection" page.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2019-03-09 20:33:07 UTC
Created attachment 86413 [details] [review]
Bug 15911: (follow-up) Allow enter to submit using the submit button

This patch modifies the checkEnter function so that it is possible to
submit a form by tabbing to the submit button and hitting ENTER to
submit.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Nick Clemens (kidclamp) 2019-03-16 01:11:09 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize (ashimema) 2019-03-19 11:01:21 UTC
Enhancement, will not be backported to 18.11.x series.