mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Readd some stuff
This commit is contained in:
parent
292c24b38f
commit
4f803d0aa6
@ -29,10 +29,23 @@ nopaque.Workarounds.apply = function() {
|
|||||||
|
|
||||||
nopaque.Forms = {};
|
nopaque.Forms = {};
|
||||||
nopaque.Forms.init = function() {
|
nopaque.Forms.init = function() {
|
||||||
var abortRequestElement, progressElement, progressModal,
|
var abortRequestElement, parentElement, progressElement, progressModal,
|
||||||
progressModalElement, request;
|
progressModalElement, request, submitElement;
|
||||||
|
|
||||||
for (let form of document.querySelectorAll(".nopaque-job-form")) {
|
for (let form of document.querySelectorAll(".nopaque-job-form")) {
|
||||||
|
submitElement = form.querySelector('button[type="submit"]');
|
||||||
|
submitElement.addEventListener("click", function() {
|
||||||
|
for (let selectElement of form.querySelectorAll('select')) {
|
||||||
|
if (selectElement.value === "") {
|
||||||
|
parentElement = selectElement.closest(".input-field");
|
||||||
|
for (let helperTextElement of parentElement.querySelectorAll(".helper-text")) {
|
||||||
|
helperTextElement.remove();
|
||||||
|
}
|
||||||
|
parentElement.insertAdjacentHTML("beforeend", `<span class="helper-text red-text">Please select an option.</span>`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
request = new XMLHttpRequest();
|
request = new XMLHttpRequest();
|
||||||
if (form.dataset.hasOwnProperty("progressModal")) {
|
if (form.dataset.hasOwnProperty("progressModal")) {
|
||||||
progressModalElement = document.getElementById(form.dataset.progressModal);
|
progressModalElement = document.getElementById(form.dataset.progressModal);
|
||||||
|
Loading…
Reference in New Issue
Block a user