[Koha-bugs] [Bug 15855] Disabling multiple submission on search form

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Feb 19 15:21:25 CET 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15855

--- Comment #1 from Arthur Suzuki <arthur.suzuki at univ-lyon3.fr> ---
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).

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list