Minor tweaks

This commit is contained in:
zandercymatics 2024-05-15 12:08:53 -06:00
parent b2e52b5267
commit 04ced13eb6
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -890,7 +890,7 @@ function hideDeletedForms() {
// Update the icon reference to the info icon // Update the icon reference to the info icon
if (parts.length > 1) { if (parts.length > 1) {
parts[1] = "info"; parts[1] = "info_outline";
useElement.setAttribute("xlink:href", parts.join("#")); useElement.setAttribute("xlink:href", parts.join("#"));
// Change the color to => $dhs-dark-gray-60 // Change the color to => $dhs-dark-gray-60
@ -938,6 +938,7 @@ function hideDeletedForms() {
} }
function showInputOnErrorFields(){ function showInputOnErrorFields(){
let fullNameButtonClicked = false
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('[id$="__edit-button"]').forEach(function(button) { document.querySelectorAll('[id$="__edit-button"]').forEach(function(button) {
let fieldIdParts = button.id.split("__") let fieldIdParts = button.id.split("__")
@ -947,19 +948,27 @@ function hideDeletedForms() {
let errorMessage = document.querySelector(`#id_${fieldName}__error-message`); let errorMessage = document.querySelector(`#id_${fieldName}__error-message`);
if (errorMessage) { if (errorMessage) {
let nameFields = ["first_name", "middle_name", "last_name"] let nameFields = ["first_name", "middle_name", "last_name"]
button.click()
// If either the full_name field errors out, // If either the full_name field errors out,
// or if any of its associated fields do - show all name related fields. // or if any of its associated fields do - show all name related fields.
// Otherwise, just show the problematic field. // Otherwise, just show the problematic field.
if (fieldName == "full_name"){ if (nameFields.includes(fieldName) && !fullNameButtonClicked){
handleFullNameField(fieldName); fullNameButton = document.querySelector("#full_name__edit-button")
}else if (nameFields.includes(fieldName)){ if (fullNameButton) {
handleFullNameField("full_name"); fullNameButton.click()
button.click() fullNameButtonClicked = true
} }
else {
button.click() let readonlyId = getReadonlyFieldId("full_name");
let readonlyField = document.querySelector(readonlyId);
if (readonlyField) {
readonlyField.classList.toggle("overlapped-full-name-field");
} }
} }
}
} }
}); });
}); });