Skip to content

Commit

Permalink
Merge pull request #553 from maykinmedia/fix/1268-prevent-multiple-ca…
Browse files Browse the repository at this point in the history
…se-documents-upload

[#1268] Disable case document button when form is being submitted
  • Loading branch information
alextreme authored Apr 2, 2023
2 parents 0b06110 + 0435f72 commit a90a00e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/open_inwoner/js/components/cases/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class DisableSubmitButton {
constructor(form) {
this.form = form
this.form.addEventListener('submit', this.disableButton.bind(this))
}

disableButton() {
const submitButton = this.form.querySelector('button[type="submit"]')
submitButton.setAttribute('disabled', 'true')
}
}

const caseDocumentForms = document.querySelectorAll('#document-upload')
;[...caseDocumentForms].forEach(
(caseDocumentForm) => new DisableSubmitButton(caseDocumentForm)
)
1 change: 1 addition & 0 deletions src/open_inwoner/js/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import './anchor-menu'
import './autocomplete-search'
import './autocomplete'
import './autosumbit'
import './cases'
import './confirmation'
import './contacts'
import './datepicker'
Expand Down
7 changes: 7 additions & 0 deletions src/open_inwoner/scss/components/Cases/Cases.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@
}
}
}

#document-upload .button[type='submit']:disabled {
border-color: var(--color-gray) !important;
color: var(--color-gray-light);
pointer-events: none;
cursor: default;
}

0 comments on commit a90a00e

Please sign in to comment.