Warn when no controlnet model is chosen (#1503)

* Warn when no controlnet model is chosen

* Update main.js
This commit is contained in:
JeLuF 2023-08-17 07:48:00 +02:00 committed by GitHub
parent 2baad73bb9
commit 23a0a48b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -1461,6 +1461,9 @@ button#save-system-settings-btn {
cursor: pointer;; cursor: pointer;;
} }
.validation-failed {
border: solid 2px red;
}
/* SCROLLBARS */ /* SCROLLBARS */
:root { :root {
--scrollbar-width: 14px; --scrollbar-width: 14px;

View File

@ -821,12 +821,25 @@ function makeImage() {
} }
if (!randomSeedField.checked && seedField.value == "") { if (!randomSeedField.checked && seedField.value == "") {
alert('The "Seed" field must not be empty.') alert('The "Seed" field must not be empty.')
seedField.classList.add("validation-failed")
return return
} }
seedField.classList.remove("validation-failed")
if (numInferenceStepsField.value == "") { if (numInferenceStepsField.value == "") {
alert('The "Inference Steps" field must not be empty.') alert('The "Inference Steps" field must not be empty.')
numInferenceStepsField.classList.add("validation-failed")
return 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) { if (numOutputsTotalField.value == "" || numOutputsTotalField.value == 0) {
numOutputsTotalField.value = 1 numOutputsTotalField.value = 1
} }