From 4f803d0aa65dfc0102aa7a531e97ca6c4a8071ec Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Tue, 18 Feb 2020 14:44:31 +0100
Subject: [PATCH] Readd some stuff
---
app/static/js/nopaque.js | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/app/static/js/nopaque.js b/app/static/js/nopaque.js
index 01406fac..0301a253 100644
--- a/app/static/js/nopaque.js
+++ b/app/static/js/nopaque.js
@@ -29,10 +29,23 @@ nopaque.Workarounds.apply = function() {
nopaque.Forms = {};
nopaque.Forms.init = function() {
- var abortRequestElement, progressElement, progressModal,
- progressModalElement, request;
+ var abortRequestElement, parentElement, progressElement, progressModal,
+ progressModalElement, request, submitElement;
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", `Please select an option.`);
+ }
+ }
+ });
+
request = new XMLHttpRequest();
if (form.dataset.hasOwnProperty("progressModal")) {
progressModalElement = document.getElementById(form.dataset.progressModal);