From 23a0a48b814bc4c52df602e6e6999d3bca802ade Mon Sep 17 00:00:00 2001 From: JeLuF Date: Thu, 17 Aug 2023 07:48:00 +0200 Subject: [PATCH] Warn when no controlnet model is chosen (#1503) * Warn when no controlnet model is chosen * Update main.js --- ui/media/css/main.css | 3 +++ ui/media/js/main.js | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ui/media/css/main.css b/ui/media/css/main.css index 745cf53c..48f30f5b 100644 --- a/ui/media/css/main.css +++ b/ui/media/css/main.css @@ -1461,6 +1461,9 @@ button#save-system-settings-btn { cursor: pointer;; } +.validation-failed { + border: solid 2px red; +} /* SCROLLBARS */ :root { --scrollbar-width: 14px; diff --git a/ui/media/js/main.js b/ui/media/js/main.js index fad67ab4..162ea3be 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -821,12 +821,25 @@ function makeImage() { } if (!randomSeedField.checked && seedField.value == "") { alert('The "Seed" field must not be empty.') + seedField.classList.add("validation-failed") return } + seedField.classList.remove("validation-failed") + if (numInferenceStepsField.value == "") { alert('The "Inference Steps" field must not be empty.') + numInferenceStepsField.classList.add("validation-failed") return } + numInferenceStepsField.classList.remove("validation-failed") + + if (controlnetModelField.value === "" && IMAGE_REGEX.test(controlImagePreview.src)) { + alert("Please choose a ControlNet model, to use the ControlNet image.") + document.getElementById("controlnet_model").classList.add("validation-failed") + return + } + document.getElementById("controlnet_model").classList.remove("validation-failed") + if (numOutputsTotalField.value == "" || numOutputsTotalField.value == 0) { numOutputsTotalField.value = 1 }