Bug 15911 - Use noEnterSubmit CSS class instead of prevent_submit.js
Summary: Use noEnterSubmit CSS class instead of prevent_submit.js
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-24 19:43 UTC by Owen Leonard
Modified: 2019-03-19 11:01 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js (4.76 KB, patch)
2019-02-22 14:43 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js (4.85 KB, patch)
2019-03-05 01:17 UTC, Hayley Mapley
Details | Diff | Splinter Review
Bug 15911: (follow-up) Allow enter to submit using the submit button (1.32 KB, patch)
2019-03-06 18:44 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 15911: Use noEnterSubmit CSS class instead of prevent_submit.js (4.90 KB, patch)
2019-03-09 20:33 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 15911: (follow-up) Allow enter to submit using the submit button (1.38 KB, patch)
2019-03-09 20:33 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 Mapley 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 2019-03-16 01:11:09 UTC
Awesome work all!

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