This commit adds a new jquery function to staff-global.js, preventDoubleFormSubmit().
When used thusly: $('#form-id').preventDoubleFormSubmit();
It will prevent a submitted form from being submitted a second time.
It is currently only added to the Place Hold form in reserve/request.pl
http://bugs.koha-community.org/show_bug.cgi?id=4045
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Tested:
Double clicking no longer causes identical double holds to be placed.
passes prove t xt t/db_dependent in line with current master.
Reminder: this will need to be added to the OPAC as well.
function clearHoldFor(){
$.cookie("holdfor",null, { path: "/", expires: 0 });
-}
\ No newline at end of file
+}
+
+jQuery.fn.preventDoubleFormSubmit = function() {
+ jQuery(this).submit(function() {
+ if (this.beenSubmitted)
+ return false;
+ else
+ this.beenSubmitted = true;
+ });
+};
\ No newline at end of file
$("#requestany").attr("checked","checked");
}
});
+
+ $('#hold-request-form').preventDoubleFormSubmit();
});
// ]]>
<fieldset class="rows left">
<legend>Hold details</legend>
[% UNLESS ( multi_hold ) %]
- <form action="placerequest.pl" method="post" onsubmit="return check();" name="form">
+ <form action="placerequest.pl" method="post" onsubmit="return check();" name="form" id="hold-request-form">
[% ELSE %]
<form action="placerequest.pl" method="post" onsubmit="return checkMultiHold();" name="form">
[% END %]