/** * Provides functions to read and update values/states of different form input types. */ // Get value from a text input or textarea function getInputValue(elementId) { const input = document.getElementById(elementId); return input ? input.value : null; } // Set value for a text input or textarea function setInputValue(elementId, value) { const input = document.getElementById(elementId); if (input) input.value = value; } // Get checked state of a checkbox or radio button function getCheckedState(elementId) { const checkbox = document.getElementById(elementId); return checkbox ? checkbox.checked : null; } // Set checked state of a checkbox or radio button function setCheckedState(elementId, isChecked) { const checkbox = document.getElementById(elementId); if (checkbox) checkbox.checked = isChecked; } // Get selected value from a dropdown (select element) function getSelectValue(elementId) { const select = document.getElementById(elementId); return select ? select.value : null; } // Set selected value for a dropdown (select element) function setSelectValue(elementId, value) { const select = document.getElementById(elementId); if (select) select.value = value; } // Example Usage (assuming HTML inputs like , ,