cleanup urbanization JS

This commit is contained in:
Rachid Mrad 2024-12-03 16:36:38 -05:00
parent f7bbed1f03
commit 0986295ab3
No known key found for this signature in database
2 changed files with 10 additions and 4 deletions

View file

@ -1,12 +1,18 @@
import { hideElement, showElement } from './helpers.js';
function setupUrbanizationToggle(stateTerritoryField) {
var urbanizationField = document.getElementById('urbanization-field');
let urbanizationField = document.getElementById('urbanization-field');
if (!urbanizationField) {
console.error("Cannot find expect field: #urbanization-field");
return;
}
function toggleUrbanizationField() {
// Checking specifically for Puerto Rico only
if (stateTerritoryField.value === 'PR') {
urbanizationField.style.display = 'block';
showElement(urbanizationField);
} else {
urbanizationField.style.display = 'none';
hideElement(urbanizationField);
}
}

View file

@ -37,7 +37,7 @@
{% input_with_errors forms.0.zipcode %}
{% endwith %}
<div id="urbanization-field">
<div id="urbanization-field" class="display-none">
{% input_with_errors forms.0.urbanization %}
</div>