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