Fix job form error message generation

This commit is contained in:
Patrick Jentsch 2020-03-02 14:57:12 +01:00
parent 55a86a60f3
commit fb0ca7e759

View File

@ -79,7 +79,7 @@ nopaque.Forms.init = function() {
} }
if (request.status === 400) { if (request.status === 400) {
for (let [field, errors] of Object.entries(JSON.parse(this.responseText))) { for (let [field, errors] of Object.entries(JSON.parse(this.responseText))) {
fieldElement = form.querySelector(`input[name="${field}"]`).closest(".input-field"); fieldElement = form.querySelector(`input[name="add-job-form-${field}"]`).closest(".input-field");
for (let error of errors) { for (let error of errors) {
fieldElement.insertAdjacentHTML("beforeend", `<span class="helper-text red-text">${error}</span>`); fieldElement.insertAdjacentHTML("beforeend", `<span class="helper-text red-text">${error}</span>`);
} }