Skip to content

Commit

Permalink
Don't submit on disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
thefrosty committed Nov 15, 2023
1 parent ee5606d commit 4d148dd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions assets/js/licensemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
'use strict'

$(document).ready(function () {
$('a[id^="EddSoftwareLicenseManagerButton"]').on('click', function (e) {
$('a[id^="EddSoftwareLicenseManagerButton"]:not(:disabled)').on('click', function (e) {
e.preventDefault()
const $this = $(this)
const $element = $('input[name$="[' + $this.data('plugin_id') + ']"]')

if ($element.val().length === 0) {
if ($this.attr('disabled') === 'disabled' || $element.val().length === 0) {
return
}

Expand All @@ -30,11 +30,11 @@
if (typeof response.success !== 'undefined' && response.success) {
$this.closest('form').submit()
}
$this.attr('disabled', false)
$('img[class="EddLicenseLoader"]').remove()
},
fail: function () {
window.alert('Unknown Error')
fail: function (response) {
$this.attr('disabled', false)
window.alert(response)
}
})
})
Expand Down

0 comments on commit 4d148dd

Please sign in to comment.