Summary: | Disabling multiple submission on search form | ||
---|---|---|---|
Product: | Koha | Reporter: | Arthur Suzuki <arthur.suzuki> |
Component: | OPAC | Assignee: | Owen Leonard <oleonard> |
Status: | NEW --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | jonathan.druart, marjorie.barry-vila, veron |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17523 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Extract from koha-opac-access_log
Bug 18555: Create patron list from patron import |
Here is the code designed by Olivier : // multi soumission Enter var submitted; $('#translControl1').bind('keyup',function() { submitted = false; }); $('#translControl1').bind('keydown',function(event) { code = event.keyCode||event.which||event.charCode||event.char||0; if(code == 13) { if (submitted == false) { submitted = true; $('#searchform').submit(); } else { event.preventDefault(); event.returnValue = false; return false; } } }); The use of keyCode permits to submit form only once, and only uppon key down event. It prevents the users to fire multiple searches while holding the "Return" key down (a behavior which is still possible with previously shared code). Created attachment 63240 [details] [review] Bug 18555: Create patron list from patron import Create a patron list from imported patrons to be used for printing patron cards and other patron list related actions. To test: - Apply patch - Go to Home > Tools > Import patrons - Select a file to import and check new checkbox 'Create patron list' - Import file - Verify that in import results you see the time stamped name of the patronlist containig the imported patrons (if any patrons were imported) - Go to Home > Tools > Patron lists - Verify that the list shows up and contains the imported patrons Comment on attachment 63240 [details] [review] Bug 18555: Create patron list from patron import Sorry, mistaked with bug number, should put my glasses... |
Created attachment 48203 [details] Extract from koha-opac-access_log Some impatient users tends to click several times on the “Go” button of the search form on OPAC. Probably in a desperate hope that this will speed up the whole process. However the result is quite opposite, as Zebra is then queried multiple times which increases the server cpu load, until it reach 100% and cause Denial of Service (boooh…) We had the idea of disabling the “searchsubmit” button upon first click. This is done by adding onclick=”this.disabled=true;this.form.submit();return true;” after “id=searchsubmit” in masthead.inc. It is also possible to solve this issue by adding the following section to opacuser.js: $(document).ready(function() { $('#searchform').submit(function() { $('#searchsubmit').prop('disabled',true).text('searching...'); }); }); Thanks to Frederic Demians and Olivier Crouzet for their help.