Add disable_submit_button() global JS function

managed to find another use for this, so split it out
This commit is contained in:
Lance Edgar 2018-03-06 16:25:54 -06:00
parent 5765533491
commit 802f4bfd6b

View file

@ -40,6 +40,20 @@ function disable_button(button, label) {
}
function disable_submit_button(form, label) {
// for some reason chrome requires us to do things this way...
// https://stackoverflow.com/questions/16867080/onclick-javascript-stops-form-submit-in-chrome
// https://stackoverflow.com/questions/5691054/disable-submit-button-on-form-submit
var submit = $(form).find('input[type="submit"]');
if (! submit.length) {
submit = $(form).find('button[type="submit"]');
}
if (submit.length) {
disable_button(submit, label);
}
}
/*
* Load next / previous page of results to grid. This function is called on
* the click event from the pager links, via inline script code.
@ -208,18 +222,7 @@ $(function() {
$('a.button.autodisable').click(function() {
disable_button(this);
});
// for some reason chrome requires us to do things this way...
// https://stackoverflow.com/questions/16867080/onclick-javascript-stops-form-submit-in-chrome
// https://stackoverflow.com/questions/5691054/disable-submit-button-on-form-submit
$('form.autodisable').submit(function() {
var submit = $(this).find('input[type="submit"]');
if (! submit.length) {
submit = $(this).find('button[type="submit"]');
}
if (submit.length) {
disable_button(submit);
}
});
$('form.autodisable').submit(disable_submit_button);
/*
* enhance dropdowns